Error using SMTP object.

Discussion in 'Perl Misc' started by pgmrdan, Dec 1, 2007.

  1. pgmrdan

    pgmrdan Guest

    I'm getting the following message -

    Can't call method "domain" on an undefined value at domain.pl line 4.

    When trying to execute the following -

    use Net::SMTP;

    $smtp = Net::SMTP->new('xxxxxxxxxx.xxx');
    print $smtp->domain,"\n";
    $smtp->quit;

    I'm using my ISP provider in place of the x's.

    What am I doing wrong?

    Thanks.
     
    pgmrdan, Dec 1, 2007
    #1
    1. Advertising

  2. pgmrdan

    pgmrdan Guest

    Never mind. I had the wrong SMTP server name. It works now.

    Thanks.

    "pgmrdan" <> wrote in message
    news:fiqb57$83p$...
    > I'm getting the following message -
    >
    > Can't call method "domain" on an undefined value at domain.pl line 4.
    >
    > When trying to execute the following -
    >
    > use Net::SMTP;
    >
    > $smtp = Net::SMTP->new('xxxxxxxxxx.xxx');
    > print $smtp->domain,"\n";
    > $smtp->quit;
    >
    > I'm using my ISP provider in place of the x's.
    >
    > What am I doing wrong?
    >
    > Thanks.
    >
    >
     
    pgmrdan, Dec 1, 2007
    #2
    1. Advertising

  3. On Fri, 30 Nov 2007 19:41:05 -0600, pgmrdan wrote:

    > Never mind. I had the wrong SMTP server name. It works now.


    Yes, but....

    > "pgmrdan" <> wrote in message
    > news:fiqb57$83p$...
    >> I'm getting the following message -
    >>
    >> Can't call method "domain" on an undefined value at domain.pl line 4.
    >>
    >> When trying to execute the following -
    >>
    >> use Net::SMTP;
    >>
    >> $smtp = Net::SMTP->new('xxxxxxxxxx.xxx');


    You never test for success here.

    $smtp = Net::SMTP->new('xxxxxxxxxx.xxx') or die "<insert suitable
    message>";

    >> print $smtp->domain,"\n";
    >> $smtp->quit;


    HTH,
    M4
     
    Martijn Lievaart, Dec 1, 2007
    #3
  4. pgmrdan

    pgmrdan Guest

    Good point! Thank you.


    "Martijn Lievaart" <> wrote in message
    news:p...
    > On Fri, 30 Nov 2007 19:41:05 -0600, pgmrdan wrote:
    >
    > > Never mind. I had the wrong SMTP server name. It works now.

    >
    > Yes, but....
    >
    > > "pgmrdan" <> wrote in message
    > > news:fiqb57$83p$...
    > >> I'm getting the following message -
    > >>
    > >> Can't call method "domain" on an undefined value at domain.pl line 4.
    > >>
    > >> When trying to execute the following -
    > >>
    > >> use Net::SMTP;
    > >>
    > >> $smtp = Net::SMTP->new('xxxxxxxxxx.xxx');

    >
    > You never test for success here.
    >
    > $smtp = Net::SMTP->new('xxxxxxxxxx.xxx') or die "<insert suitable
    > message>";
    >
    > >> print $smtp->domain,"\n";
    > >> $smtp->quit;

    >
    > HTH,
    > M4
     
    pgmrdan, Dec 2, 2007
    #4
    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. Replies:
    3
    Views:
    1,132
    Roedy Green
    Jan 24, 2006
  2. Alex Hunsley
    Replies:
    4
    Views:
    3,690
    Tim Williams (gmail)
    Jun 29, 2004
  3. Raaijmakers, Vincent \(GE Infrastructure\)

    RE: sending of mail (smtp) - connection refused - but smtp serveris running!

    Raaijmakers, Vincent \(GE Infrastructure\), Jun 29, 2004, in forum: Python
    Replies:
    0
    Views:
    913
    Raaijmakers, Vincent \(GE Infrastructure\)
    Jun 29, 2004
  4. Copelandia Cyanescens

    smtplib.SMTP "no attributes SMTP"

    Copelandia Cyanescens, Jul 31, 2004, in forum: Python
    Replies:
    2
    Views:
    1,579
    Copelandia Cyanescens
    Jul 31, 2004
  5. tshad
    Replies:
    1
    Views:
    914
    bruce barker
    May 5, 2008
Loading...

Share This Page