>>
>
> Well, again, since ianap, I'm not comfortable trying to do this, I'm
> quite sure I'd break something in a really bad way…
The Mail::Sender takes care of escaping and other crap for you, it seems.
All you need to do is :
1. Get the $name variable from the database somehow - e.g.
my $query = "SELECT friendly_name FROM some_table WHERE email = ?";
my $stmt = $dbh->prepare($query);
$stmt->execute($email);
$retval = $stmt->rows;
my $friendly_name = "unknown user";
if($retval = 1) {
my $row = $stmt->fetchrow_array;
my $friendly_name = $row[0];
}
2. Add in a 'fake_to' and/or 'fake_from' parameter in the %mail hash -
%mail = ( to =>$to,
from => $from,
fake_from => "$friendly_name <$from>",
msg => encode_base64($body),
subject =>$subject,
);
then do the normal Mail::Sender stuff :
$Mail::Sender::NO_X_MAILER = 1;
my $sender = new Mail::Sender({%smtp_connection});
$sender->Open({%mail});
$sender->SendLineEnc($body);
$sender->Close() or $logger->error('Failed to send vacation response: ' . $sender->{'error_msg'});
$logger->debug("Vacation response sent to $to, from $from");
David.
>
> I guess maybe it is harder than I thought it would be, or someone would
> have simply come up with aone liner change adding in the $name variable
> to the mix...
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Postfixadmin-devel mailing list
> Pos...@li...
> https://lists.sourceforge.net/lists/listinfo/postfixadmin-devel
|