Diary SiteMap RecentChanges About Contact 2009-06 Calendar

Search:

Matching Pages:

2009-06-06 Spam Makes Sending Mail Harder

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… :( sucks

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;

Tags:

Comments

Well, theoretically at least it should now be possible to subscribe to comment pages!

AlexSchroeder 2009-06-06 16:43 UTC


Guess not, because the webhost doesn’t have Net::SMTP::TLS installed. sucks

AlexSchroeder 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.

AlexSchroeder 2009-06-07 13:25 UTC

Please make sure you contribute only your own work, or work licensed under the GNU Free Documentation License. See Info for text formatting rules. You can edit the comment page if you need to fix typos. You can subscribe to new comments by email without leaving a comment.

To save this page you must answer this question:

Please say HELLO.

Show Google +1