Here I am trying to send mail using some Perl module. But most of them seem to be written for the last millenium. They work best with a local SMTP host. For my own needs, that no longer works. The webhost doesn’t have a sendmail binary available. The SMTP hosts I can reach require SSL and TLS authentication. Now I’m slowly digging into MIME::Entity, Mail::Internet, Mail::Mailer, Net::SMTP, Net::SMTP::SSL, Net::SMTP::TLS… 🙁 👎
After experimenting with the four or five mail accounts I have access to, I was finally able to get the following to work:
my $from = 'kensanata@gmail.com'; my $to = $from; my $host = 'mail.epfarms.org'; my $user = 'alex'; my $password = '*secret*'; use MIME::Entity; my $mail = new MIME::Entity->build(To => $to, From => $from, Subject => 'test', Path => '/Users/alex/test.html', Type => 'text/html'); use Net::SMTP::TLS; my $smtp = Net::SMTP::TLS->new($host, User => $user, Password => $password, Debug => 1); $smtp->mail($from); # sender $smtp->to($to); # recipient $smtp->data; $smtp->datasend($mail->stringify); $smtp->dataend; $smtp->quit;
#Perl #SMTP
(Please contact me if you want to remove your comment.)
⁂
Well, theoretically at least it should now be possible to subscribe to comment pages!
– Alex Schroeder 2009-06-06 16:43 UTC
---
Guess not, because the webhost doesn’t have Net::SMTP::TLS installed. 👎
– Alex Schroeder 2009-06-06 16:58 UTC
---
I think it works after all! Luckily I wrote my script such that it gets the page content and subscriber list via ordinary HTTP requests, so the cron job that sends out emails can run anywhere on the net. This one is running on a server hosted by Eggplant Farms.
– Alex Schroeder 2009-06-07 13:25 UTC