http://www.perlmonks.org?node_id=986450

Steve_BZ has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I'm using Mail::Sender to send emails automatically from my application: it's a very nice little tool.

However I have a problem in that, depending on the setup (ie ISP/router), sometimes it works and sometimes the connection times out (Error connect() failed: Connection timed out. However other email clients do work.

I have extracted a bit of the code into a standalone application which reproduces the problem. However the debug file remains resolutely empty.

#!/usr/bin/perl -w use strict; use Mail::Sender; my $sender = new Mail::Sender { auth => 'PLAIN', authid => 'user', # Change this. authpwd => 'password', # Change this. smtp => 'smtpserver.mydomain.com', # Change this. from => 'user@mydomain.com', # Change this. to => 'foo.bar@yourdomain.com', # Change this. subject => 'test subject', msg => 'This is a text email', file => '/home/foo/bar/default.pdf', debug => "/home/foo/bar/SendMailDebug.txt", debug_level => 4, timeout => 500, }; my $result = $sender->MailFile({ msg => $sender->{msg}, file => $sender->{file}, }); print "$sender->{error_msg}\n>>>End.\n"; 1;

Am I using it right?

How can I get the debug function to give me something useful?

Any other ideas.

Regards

Steve