[San-Diego-pm] Mail::Sender

Joel Fentin joel at fentin.com
Sat May 12 11:48:40 PDT 2007


Chris Grau wrote:
> On Sat, May 12, 2007 at 10:31:26AM -0700, Joel Fentin wrote:
>> I'm looking for a way of emailing with attachments. Since Mail::Sender
>> is already installed in my account, this where I started. I've been
>> running lots of variations of the below. They run to the end without
>> errors. But they don't send any emails.
> 
> I've never used this particular module, but my brief scan of the
> documentation tells me that you appear to be using it correctly.
> 
>> my $sender = new Mail::Sender({
>> smtp => 'smtp.nethere.net',
>> from => 'avocado at nethere.com',
>> }) or die "Error in mailing : $Mail::Sender::Error\n";
> 
> I assume the SMTP server is correct.  What happens when you try to speak
> to it via telnet?  It may be fine, but this is where I always start with
> mail problems.

Telnet? Speak to what? How? Would the host let me?

I don't really know if the SMTP is correct. I have two that seem to work 
with this email client (thunderbird). smtp.vcweb.org (microwave link 
from my house to Mt. Palomar) and smtp.nethere.net (my service 
provider). I've tried both. My website is hosted by bulletweb. Not sure 
if I need another smtp.

Also, in some of the examples I saw on line, the smtp => was omitted.

> 
>> $sender->OpenMultipart({
>>      to => 'joel at fentin.com',
>>      subject => 'Testing 3',
>> });
>>
>> $sender->Body;
>> $sender->SendLineEnc( 'This is a send attachment test.' );
>> $sender->SendFile({
>>      description => 'Raw Data File',
>>      encoding => '7BIT',
>>      file => 'IRF510.pdf',
>> });
>> $sender->Close;
> 
> Have you tried checking the results of each method call?  According to
> the documentation:
> 
>     Returns the Mail::Sender object if successfull, negative error code
>     if not, zero if $sender was not connected at all. The zero usualy
>     means that the Open/OpenMultipart failed and you did not test its
>     return value.
> 
> Looks like you can configure the Mail::Sender object to die on error.
> That might be useful for debugging.

Not quite sure if I get what you are saying.
I changed the last line from $sender->Close;
to:
$sender->Close or die "Failed to send the message: 
$sender->{'error_msg'}\n";

The result was the following:
Failed to send the message: Connection not established

I also put an error trap in the openmultipart statement but didn't get 
an error there.

-- 
Joel Fentin       tel: 760-749-8863    FAX: 760-749-8864
Email:            http://fentin.com/me/ContactMe.html
Biz Website:      http://fentin.com
Personal Website: http://fentin.com/me


More information about the San-Diego-pm mailing list