For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > January 2006 > Trouble sending an email with Mailer module









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Trouble sending an email with Mailer module
laredotornado@zipmail.com

2006-01-31, 7:00 pm

Hi,

I'm having some trouble getting the Mailer module to work. I keep
getting this error

No recipient addresses found in header

although in my code, below, I include a "To" clause. But clearly I'm
doing something wrong ...

my $body = "Blah blah blah:\n\n";

my %headers = {From => "$p_sender",
To => "$p_recipient",
Subject => "$p_subject"
};
my $mailer = Mail::Mailer->new();
$mailer->open(\%headers);
print $mailer $body;
$mailer->close;

Any ideas? Thanks, - Dave

Ch Lamprecht

2006-01-31, 7:00 pm

laredotornado@zipmail.com wrote:
> Hi,

use strict;
use warnings;

>
> my $body = "Blah blah blah:\n\n";
>


> my %headers = {From => "$p_sender",
> ^ To => "$p_recipient",
> ^ Subject => "$p_subject"
> ^ };

-------------^a hash --^ a hashref
> my $mailer = Mail::Mailer->new();
> $mailer->open(\%headers);
> print $mailer $body;
> $mailer->close;
>
> Any ideas? Thanks, - Dave
>


HTH Christoph
--

perl -e "print scalar reverse q/ed.enilno@ergn.l.hc/"
Gunnar Hjalmarsson

2006-01-31, 7:00 pm

laredotornado@zipmail.com wrote:
> I'm having some trouble getting the Mailer module to work. I keep
> getting this error
>
> No recipient addresses found in header
>
> although in my code, below, I include a "To" clause. But clearly I'm
> doing something wrong ...


Indeed you are; you ask for help here before asking Perl to help you by
using warnings.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com