[San-Diego-pm] Mail::Sender
Chris Grau
chris at chrisgrau.com
Sat May 12 10:49:06 PDT 2007
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.
> $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.
--
Chris Grau
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/san-diego-pm/attachments/20070512/8a5e9fbd/attachment.bin
More information about the San-Diego-pm
mailing list