Here’s something that finally worked. To remember:
1. Don’t use Net::SMTP::SSL
2. Don’t use Net::SMTP::TLS
3. Don’t use Net::SSLGlue::SMTP
4. Use Net::SMTP
5. Make use Authen::SASL is installed
6. Make sure the mail contains all the necessary headers
7. Look at the debug output!
8. Don’t worry about SSL_version
Gaaah. This took way too long to figure out. So here’s my test script:
use Modern::Perl; use Net::SMTP; use Authen::SASL qw(Perl); my $subject = "Hello"; my $to = 'kensanata@gmail.com'; my $user = 'notifications@alexschroeder.ch'; my $password = "*secret*"; my $host = "smtp.migadu.com:587"; my $from = 'notifications@alexschroeder.ch'; my $mail = <<EOT; From: $from To: $to Subject: $subject This is the mail. EOT my $verbose = 1; my $smtp = Net::SMTP->new($host, Debug => 1); $smtp->starttls(); # the following requires Authen::SASL! $smtp->auth($user, $password); $smtp->mail($from); if ($smtp->to($to)) { $smtp->data; $smtp->datasend($mail); $smtp->dataend; } else { print "Error: ", $smtp->message(); } $smtp->quit;
#Perl
(Please contact me if you want to remove your comment.)
⁂
I wonder whether I should switch my notifications from the GMail account to the Migadu account. I get the feeling that GMail (and maybe others as well) are too quick to mark the notifications as spam. But then again, who knows.
– Alex Schroeder 2019-10-04 16:40 UTC