sending email with Net::SMTP::SSL -- help needed

Discussion in 'Perl Misc' started by Kamil, Sep 21, 2005.

  1. Kamil

    Kamil Guest

    Hi, I am new to perl, and dont know much about CPAN and modules... What
    am I doing wrong in the Net::SMTP::SSL constructor?!

    This works fine:

    my $smtp_port=465;
    my $smtp = Net::SMTP::SSL->new(Host => "smtp.gmail.com", Port =>
    $smtp_port);
    die "Couldn't connect to server" unless $smtp;


    But, this does NOT work:

    my $smtp_port=465;
    my $smtp_server="smtp.google.com";
    my $smtp = Net::SMTP::SSL->new(Host => $smtp_server, Port =>
    $smtp_port);
    die "Couldn't connect to server" unless $smtp;


    Error:

    Couldn't connect to server at ./process_sweep.pl line 1298.


    The documentation says:

    Host - SMTP host to connect to. It may be a single scalar, as defined
    for the PeerAddr option in IO::Socket::INET, or a reference to an array
    with hosts to try in turn. The "host" method will return the value
    which was used to connect to the host.


    I have tried using:

    my $smtp_port=465;
    my @smtp_server;
    push(@smtp_server,"smtp.google.com");
    my $smtp = Net::SMTP::SSL->new(Host => \@smtp_server, Port =>
    $smtp_port);
    die "Couldn't connect to server" unless $smtp;


    But it doesn't work either...
     
    Kamil, Sep 21, 2005
    #1
    1. Advertising

  2. Kamil

    Eric Bohlman Guest

    "Kamil" <> wrote in news:1127286563.416133.57220
    @g43g2000cwa.googlegroups.com:

    > Hi, I am new to perl, and dont know much about CPAN and modules... What
    > am I doing wrong in the Net::SMTP::SSL constructor?!
    >
    > This works fine:
    >
    > my $smtp_port=465;
    > my $smtp = Net::SMTP::SSL->new(Host => "smtp.gmail.com", Port =>
    > $smtp_port);
    > die "Couldn't connect to server" unless $smtp;
    >
    >
    > But, this does NOT work:
    >
    > my $smtp_port=465;
    > my $smtp_server="smtp.google.com";
    > my $smtp = Net::SMTP::SSL->new(Host => $smtp_server, Port =>
    > $smtp_port);
    > die "Couldn't connect to server" unless $smtp;
    >
    >
    > Error:
    >
    > Couldn't connect to server at ./process_sweep.pl line 1298.


    The most obvious thing I see is that you're trying to connect to two
    different SMTP servers. Does your first attempt work if you substitute
    "smtp.google.com" for "smtp.gmail.com"?
     
    Eric Bohlman, Sep 21, 2005
    #2
    1. Advertising

  3. Kamil

    Kamil Guest

    Thanks for the suggestion Eric. It works fine now. Dunno how I missed
    that... lack of sleep maybe... Thanks again.
     
    Kamil, Sep 22, 2005
    #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. bivin
    Replies:
    1
    Views:
    731
    venkat
    Jun 27, 2003
  2. Ersin Gençtürk

    sending inline image in email via .net smtp mail

    Ersin Gençtürk, Feb 28, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    4,016
    bruce barker
    Feb 28, 2005
  3. Replies:
    3
    Views:
    1,118
    Roedy Green
    Jan 24, 2006
  4. Alex Hunsley
    Replies:
    4
    Views:
    3,630
    Tim Williams (gmail)
    Jun 29, 2004
  5. 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:
    903
    Raaijmakers, Vincent \(GE Infrastructure\)
    Jun 29, 2004
Loading...

Share This Page