I think MIME::Lite will use the default mailer (e.g. sendmail) unless you tell it otherwise. You may have more luck using SMTP as mail servers tend to treat authenticated emails with more respect. I have just asked my own question about Net::SMTP so have this snippet at hand, using Email::Stuffer. I haven't had any problems with failed deliveries.
sub send_email {
my $msg = shift;
my $sender = Email::Stuffer->new;
$sender->transport('SMTP',
host => 'mail.example.com',
sasl_username => 'username',
sasl_password => 'password',
helo => 'example.com',
ssl => 1,
debug => 1,
);
$sender->to( $msg->{'to'} );
$sender->from( $msg->{'from'} );
$sender->subject( $msg->{'subject'} );
$sender->text_body( $msg->{'body'} );
if ( my $attachments = $msg->{'attachments'} ) {
for my $attachment ( @$attachments ) {
$sender->attach_file( $attachment );
}
}
my $sent = $sender->send;
return $sent;
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.