Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Sending mail on a bad server...

by andyf (Pilgrim)
on Jun 27, 2004 at 20:29 UTC ( [id://370037]=note: print w/replies, xml ) Need Help??


in reply to Sending mail on a bad server...

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://370037]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2024-04-18 09:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found