Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 30069

How to write an Net::SMTP email in perl

$
0
0

None of my hosts have any higher email modules, so I'd prefer to get this working without additional modules.

I've tried using google smtp servers (which i got working with \sendmail in XAMPP but never through Net::SMTP), I've tried secureserver.net smtp servers. with and without SSL, with and without Hello lines, port 465 or 25. Tried running from my local XAMPP server disabled all firewalls, tried running it remotely on goDaddy server.

Seems to be timing out and 'smtp failed'. never getting to '...' even without the unless($smtp) test. failing to get past auth, but since 'smtp failed' is being fired i assume its a problem with how i am forming the initial declaration of the object? Though I've tried this in several different ways and I'm not getting any actual server errors.

my $smtp = Net::SMTP->new($smtpserver,
    SSL => 1,                   
    Timeout => 60,
    Port => $smtpport,  # tried 25 and 465
    Debug => 1
);
    unless($smtp) { #tried with and without this
        print "smtp failed<br>[".$!."]<br>and<br>".$IO::Socket::SSL::SSL_ERROR;
    }
$smtp->auth($smtpuser, $smtppassword);    #nothing under this line is done
$smtp->mail($smtpuser);            #but i have checked and double checked the data
$smtp->recipient($recipi);         #pointed to several email addys but never arrive
$smtp->data();
$smtp->datasend("From: $smtpuser");
$smtp->datasend("To: $recipi");
$smtp->datasend("Subject: test mail ver six sm loc 12"); 
$smtp->datasend("\n");
$smtp->datasend("blah blah");
$smtp->dataend();
$smtp->quit;
print"...";  #never gets printed

Any suggestions welcome, the only thing I've thought of and not tried is including the authentication in the initial object deceleration, i can find no where that shows how to do that.

edit; added $! and $IO::Socket::SSL::SSL_ERROR Steffen suggested the result is $! = [Bad file descriptor] and $IO::Socket::SSL::SSL_ERROR returns nothing.


Viewing all articles
Browse latest Browse all 30069

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>