in reply to Re^3: Send email via Gmail
in thread Send email via Gmail

Hi,

Funnily enough, I was just playing with that :)
use Net::SMTP; my $smtp = Net::SMTP->new('smtp.gmail.com', Hello => 'smtp.gmail.com', Timeout => 30, Debug => 1, SSL => 1 ) || die "Error: $!"; $smtp->auth($CFG->{db_smtp_user}, $CFG->{db_smtp_pass}) or die "C +ould not authenticate with mail.\n"; $smtp->data(); $smtp->datasend($email) || die $!; $smtp->dataend() || die $smtp->message();


It complains on line 99, which is:

$smtp->dataend() || die $!;

Which gives the following error message:

5.5.1 Unrecognized command. vs7sm25292357wjb.10 - gsmtp


I found a similar post here: http://www.perlmonks.org/?node_id=680369, but I'm not quite sure what the suggestion is (it also 2008, so I'm not sure if its relative any more)

Just to clarify a bit more, this is the debug that reports the error:

Net::SMTP::_SSL>>> Net::SMTP::_SSL Net::SMTP::_SSL>>> IO::Socket::SSL(2.019) Net::SMTP::_SSL>>> IO::Socket::IP(0.32) Net::SMTP::_SSL>>> IO::Socket(1.38) Net::SMTP::_SSL>>> IO::Handle(1.35) Net::SMTP::_SSL>>> Exporter(5.71) Net::SMTP::_SSL>>> Net::SMTP(3.10) Net::SMTP::_SSL>>> Net::Cmd(3.10) ******* Net::SMTP::_SSL=GLOB(0x1f5e100)<<< 220 smtp.gmail.com ESMTP y2sm147858 +26wjx.20 - gsmtp ******* Net::SMTP::_SSL=GLOB(0x1f5e100)>>> EHLO localhost.localdomain Net::SMTP::_SSL=GLOB(0x1f5e100)<<< 250-smtp.gmail.com at your service, + [2a01:7e00::f03c:91ff:fea8:e2c5]


Cheers

Andy

Replies are listed 'Best First'.
Re^5: Send email via Gmail
by hippo (Archbishop) on Oct 08, 2016 at 14:55 UTC

    Gmail doesn't recognise the command you have sent, which is reasonable because you have not explicitly sent any command. See how the example for sending an email in the Net::SMTP documentation differs from what you are doing? You have not issued a command like the example does with the mail method.