MIME::Lite, send_by_smtp just working locally not on server
Question
I added the option of sending email from my website but it doesnt work on the staging and production server(nginx).
It does work on localhost.
I added their ip address to the /postfix/main.cf
file it worked once and did not work after that. Why?
my $mailer = MIME::Lite->new(
From => $from,
To => $to,
"Reply-To" => $from,
Subject => "Sharing this post : $sub",
Type => 'text/plain',
Encoding => '8bit',
Data => $body
);
eval { $mailer->send_by_smtp('mail.holla.org'); };
if($@) {
#my @errors = $mailer->errstr;
#$.error(@errors);
$.error('<span style="color:#ce4c4c;">ERROR ($@):</span> your comment could not be sent at this time, please try again in a few minutes.')
}
}
update after adding debugging
MIME::Lite::SMTP>>> MIME::Lite::SMTP
MIME::Lite::SMTP>>> Net::SMTP(2.31)
MIME::Lite::SMTP>>> Net::Cmd(2.29)
MIME::Lite::SMTP>>> Exporter(5.64_03)
MIME::Lite::SMTP>>> IO::Socket::INET(1.31)
MIME::Lite::SMTP>>> IO::Socket(1.32)
MIME::Lite::SMTP>>> IO::Handle(1.31)
MIME::Lite::SMTP: Unexpected EOF on command channel at /usr/local/share/perl/5.14.2/MIME/Lite.pm line 2874.
line 2874
my $smtp = MIME::Lite::SMTP->new( $hostname, %opts )
or Carp::croak "SMTP Failed to connect to mail server: $!\n";
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow