Trouble sending an email with Mailer module

Discussion in 'Perl Misc' started by laredotornado@zipmail.com, Jan 31, 2006.

  1. Guest

    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
    , Jan 31, 2006
    #1
    1. Advertising

  2. Ch Lamprecht Guest

    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//"
    Ch Lamprecht, Jan 31, 2006
    #2
    1. Advertising

  3. 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
    Gunnar Hjalmarsson, Jan 31, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?S2VubmV0aCBQ?=

    Trouble w sending email

    =?Utf-8?B?S2VubmV0aCBQ?=, Aug 27, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    407
  2. Nathan Sokalski

    Trouble sending email with ASP.NET 2.0

    Nathan Sokalski, Jan 5, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    315
    Nathan Sokalski
    Jan 5, 2007
  3. Luke
    Replies:
    2
    Views:
    4,675
    Nigel Wade
    Mar 15, 2007
  4. Andrzej Adam Filip
    Replies:
    0
    Views:
    4,056
    Andrzej Adam Filip
    Mar 31, 2008
  5. rote
    Replies:
    8
    Views:
    751
Loading...

Share This Page