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.
$!
and$IO::Socket::SSL::SSL_ERROR
in yourprint "smtp failed<br>"
to get details of the error. And since youve already used
Debug` please include the actual debug output in your question. AlsoSSL =>1
makes only sense with port 465, for ports 25 and 587 you need to use$smtp->starttls()
instead. – Steffen Ullrichstarttls
will not help. As to how to usestarttls
please refer to the documentation of Net::SMTP. – Steffen Ullrich