Hi folks, I have below code:
#!/usr/local/bin/perl use strict; use warnings; use Net::SMTP; my $smtp = Net::SMTP->new('smtp.xxxxx.com', Port => 25, Timeout => +20, Debug => 1 ); my $sender = my $user = 'username@xxxxx.com'; my $password = 'xxxxxxxx'; print "Trying to authenticate.."; $smtp->auth( $user, $password ) or die "could not authenticate\n"; my $receiver = 'username@xxxxx.com'; $smtp->mail( $sender ); $smtp->to( $receiver ); $smtp->data(); $smtp->datasend( "To: $receiver\n" ); $smtp->datasend( "From: $sender\n" ); $smtp->datasend( "Content-Type: text/html\n" ); $smtp->datasend( "Subject: Testing Net::SMTP" ); $smtp->datasend( "\n" ); $smtp->datasend( 'The body of the email' ); $smtp->dataend(); $smtp->message(); $smtp->quit();
my output is below
Net::SMTP>>> Net::SMTP(3.10) Net::SMTP>>> Net::Cmd(3.10) Net::SMTP>>> Exporter(5.72) Net::SMTP>>> IO::Socket::IP(0.38) Net::SMTP>>> IO::Socket(1.38) Net::SMTP>>> IO::Handle(1.36) Net::SMTP=GLOB(0x4b6c10)<<< 220 smtp.xxxxx.com ESMTP Net::SMTP=GLOB(0x4b6c10)>>> EHLO localhost.localdomain Net::SMTP=GLOB(0x4b6c10)<<< 250-smtp.xxxxx.com Net::SMTP=GLOB(0x4b6c10)<<< 250-8BITMIME Net::SMTP=GLOB(0x4b6c10)<<< 250-SIZE 20971520 Net::SMTP=GLOB(0x4b6c10)<<< 250 STARTTLS could not authenticate Trying to authenticate..
As I know, Net::SMTP uses Authen::SASL internally to do the authentication. Is there something I still need to configure in this Authenticate?

In reply to Net::SMTP failed to authenticate by ytjPerl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.