May I recommend Net::SMTP. Here's a piece of code that has been reliable since this time last year. Its very easy to understand.
sub vianetsmtp { my $from = $_[0]; my $to = $_[1]; my $subject = $_[2]; my $body = $_[3]; $smtp = Net::SMTP->new ($maileroutrelay, Timeout => $mailerouttimeout, Debug => $maileroutdebug ) or logtofile ($logdir.'/usermailer',"can't create +new smtp mail object"); defined ($smtp) or die; my $domainmessg = $smtp->domain; my $bannermessg = $smtp->banner; $smtp->mail($from); $smtp->to($to); $smtp->data; $smtp->datasend("from:$from"); $smtp->datasend("\n"); $smtp->datasend("subject:$subject"); $smtp->datasend("\n"); $smtp->datasend("$body"); $smtp->datasend("\n"); $smtp->quit; undef $smtp; logtofile ($logdir.'/usermailer',"usermailer: mail written via net::sm +tp"); return 1; }
The extra defined getout is probably redundant, but I know better than to mess with working code :) Most mail problems are to do with routing ime, half the time its getting out but not being routed. If you use a direct method like above you can send to the destination mailserver in one.

In reply to Re: Sending mail on a bad server... by andyf
in thread Sending mail on a bad server... by TriggerDunpoe

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.