Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Trying to send an email from Perl. Both programs I've tried to use end up with the same error message: ".../IO/Socket/SSL.pm:1177: global error: Undefined SSL object". If I understand the messages correctly it appears that in both cases Net::SMTPS sends information to IO::Socket::SSL which clearly SSL.pm doesn't like. Since I'm at the limit of what I know, I thought I would ask for any information I could get.

Program 1

use Email::Sender::Simple qw(sendmail); use Email::Sender::Transport::SMTPS; use Email::Simple (); use Email::Simple::Creator (); my $smtpserver = 'ddd.com'; my $smtpport = 587; my $smtpuser = 'xxx@ddd.com'; my $smtppassword = 'yyyyyy'; my $transport = Email::Sender::Transport::SMTPS->new({ host => $smtpserver, ssl => 'starttls', port => $smtpport, sasl_username => $smtpuser, sasl_password => $smtppassword, debug => 1, }); my $email = Email::Simple->create( header => [ To => 'xxx@ddd.com', From => 'xxx@ddd.com', Subject => 'Hi!', ], body => "This is my message\n", ); sendmail($email, { transport => $transport });

The debug flag returns the following information:

Net::SMTPS>>> Net::SMTPS(0.10) Net::SMTPS>>> IO::Socket::IP(0.39) Net::SMTPS>>> IO::Socket(1.40) Net::SMTPS>>> IO::Handle(1.40) Net::SMTPS>>> Exporter(5.74) Net::SMTPS>>> Net::SMTP(3.11) Net::SMTPS>>> Net::Cmd(3.11) Net::SMTPS=GLOB(0x556317f13e28)<<< 220-ddd.com ESMTP Exim 4.92 #2 Mon, + 01 Jun 2020 07:42:59 -0600 Net::SMTPS=GLOB(0x556317f13e28)<<< 220-We do not authorize the use of +this system to transport unsolicited, Net::SMTPS=GLOB(0x556317f13e28)<<< 220 and/or bulk e-mail. Net::SMTPS=GLOB(0x556317f13e28)>>> EHLO localhost.localdomain Net::SMTPS=GLOB(0x556317f13e28)<<< 250-ddd.com Hello dsl-ip.fuse.net [ +ipaddr] Net::SMTPS=GLOB(0x556317f13e28)<<< 250-SIZE 52428800 Net::SMTPS=GLOB(0x556317f13e28)<<< 250-8BITMIME Net::SMTPS=GLOB(0x556317f13e28)<<< 250-PIPELINING Net::SMTPS=GLOB(0x556317f13e28)<<< 250-AUTH PLAIN LOGIN Net::SMTPS=GLOB(0x556317f13e28)<<< 250-STARTTLS Net::SMTPS=GLOB(0x556317f13e28)<<< 250 HELP Net::SMTPS=GLOB(0x556317f13e28)>>> STARTTLS Net::SMTPS=GLOB(0x556317f13e28)<<< 220 TLS go ahead DEBUG: .../IO/Socket/SSL.pm:1177: global error: Undefined SSL object Net::SMTPS=GLOB(0x556317f13e28)>>> EHLO localhost.localdomain Net::SMTPS=GLOB(0x556317f13e28)<<< 250-ddd.com Hello dsl-ip.fuse.net [ +ipaddr] Net::SMTPS=GLOB(0x556317f13e28)<<< 250-SIZE 52428800 Net::SMTPS=GLOB(0x556317f13e28)<<< 250-8BITMIME Net::SMTPS=GLOB(0x556317f13e28)<<< 250-PIPELINING Net::SMTPS=GLOB(0x556317f13e28)<<< 250-AUTH PLAIN LOGIN Net::SMTPS=GLOB(0x556317f13e28)<<< 250 HELP Net::SMTPS=GLOB(0x556317f13e28)>>> AUTH PLAIN -stuff here- Net::SMTPS=GLOB(0x556317f13e28)<<< 535 Incorrect authentication data failed AUTH: Incorrect authentication data

Program 2 is:

use Net::SMTPS ; use MIME::Lite ; my $msg = MIME::Lite ->new ( From => 'xxx@ddd.com', To => 'xxx@ddd.com', Subject => 'Test Message', Data => 'This is a test', Type => 'text/html' ); my $USERNAME = 'xxx@ddd.com'; my $PASSWORD = 'yyyyyyyy'; my $smtps = Net::SMTPS->new("ddd.com", Port => 587, doSSL => 'starttl +s', Debug => 1, Debug_SSL => 3); $smtps->auth ( $USERNAME, $PASSWORD ) or die("Could not authenticate\n +"); $smtps->mail('xxx@ddd.com'); $smtps->to('xxx@ddd.com'); $smtps->data(); $smtps->datasend( $msg->as_string() ); $smtps->dataend(); $smtps->quit;

The debug flags return the following information:

Net::SMTPS>>> Net::SMTPS(0.10) Net::SMTPS>>> IO::Socket::IP(0.39) Net::SMTPS>>> IO::Socket(1.40) Net::SMTPS>>> IO::Handle(1.40) Net::SMTPS>>> Exporter(5.74) Net::SMTPS>>> Net::SMTP(3.11) Net::SMTPS>>> Net::Cmd(3.11) Net::SMTPS=GLOB(0x5609e794aac0)<<< 220-ddd.com ESMTP Exim 4.92 #2 Mon, + 01 Jun 2020 08:30:01 -0600 Net::SMTPS=GLOB(0x5609e794aac0)<<< 220-We do not authorize the use of +this system to transport unsolicited, Net::SMTPS=GLOB(0x5609e794aac0)<<< 220 and/or bulk e-mail. Net::SMTPS=GLOB(0x5609e794aac0)>>> EHLO localhost.localdomain Net::SMTPS=GLOB(0x5609e794aac0)<<< 250-ddd.com Hello dsl-ip.fuse.net [ +ipaddr] Net::SMTPS=GLOB(0x5609e794aac0)<<< 250-SIZE 52428800 Net::SMTPS=GLOB(0x5609e794aac0)<<< 250-8BITMIME Net::SMTPS=GLOB(0x5609e794aac0)<<< 250-PIPELINING Net::SMTPS=GLOB(0x5609e794aac0)<<< 250-AUTH PLAIN LOGIN Net::SMTPS=GLOB(0x5609e794aac0)<<< 250-STARTTLS Net::SMTPS=GLOB(0x5609e794aac0)<<< 250 HELP Net::SMTPS=GLOB(0x5609e794aac0)>>> STARTTLS Net::SMTPS=GLOB(0x5609e794aac0)<<< 220 TLS go ahead DEBUG: .../IO/Socket/SSL.pm:3010: new ctx 94600543851488 DEBUG: .../IO/Socket/SSL.pm:1620: start handshake DEBUG: .../IO/Socket/SSL.pm:1177: global error: Undefined SSL object DEBUG: .../IO/Socket/SSL.pm:787: ssl handshake not started DEBUG: .../IO/Socket/SSL.pm:832: not using SNI because hostname is unk +nown DEBUG: .../IO/Socket/SSL.pm:864: request OCSP stapling DEBUG: .../IO/Socket/SSL.pm:880: set socket to non-blocking to enforce + timeout=120 DEBUG: .../IO/Socket/SSL.pm:894: call Net::SSLeay::connect DEBUG: .../IO/Socket/SSL.pm:897: done Net::SSLeay::connect -> -1 DEBUG: .../IO/Socket/SSL.pm:907: ssl handshake in progress DEBUG: .../IO/Socket/SSL.pm:917: waiting for fd to become ready: SSL w +ants a read first DEBUG: .../IO/Socket/SSL.pm:937: socket ready, retrying connect DEBUG: .../IO/Socket/SSL.pm:894: call Net::SSLeay::connect DEBUG: .../IO/Socket/SSL.pm:897: done Net::SSLeay::connect -> -1 DEBUG: .../IO/Socket/SSL.pm:907: ssl handshake in progress DEBUG: .../IO/Socket/SSL.pm:917: waiting for fd to become ready: SSL w +ants a read first DEBUG: .../IO/Socket/SSL.pm:937: socket ready, retrying connect DEBUG: .../IO/Socket/SSL.pm:894: call Net::SSLeay::connect DEBUG: .../IO/Socket/SSL.pm:897: done Net::SSLeay::connect -> -1 DEBUG: .../IO/Socket/SSL.pm:907: ssl handshake in progress DEBUG: .../IO/Socket/SSL.pm:917: waiting for fd to become ready: SSL w +ants a read first DEBUG: .../IO/Socket/SSL.pm:937: socket ready, retrying connect DEBUG: .../IO/Socket/SSL.pm:894: call Net::SSLeay::connect DEBUG: .../IO/Socket/SSL.pm:897: done Net::SSLeay::connect -> -1 DEBUG: .../IO/Socket/SSL.pm:907: ssl handshake in progress DEBUG: .../IO/Socket/SSL.pm:917: waiting for fd to become ready: SSL w +ants a read first DEBUG: .../IO/Socket/SSL.pm:937: socket ready, retrying connect DEBUG: .../IO/Socket/SSL.pm:894: call Net::SSLeay::connect DEBUG: .../IO/Socket/SSL.pm:2864: ok=1 [2] /C=GB/ST=Greater Manchester +/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Certification Authority/ +C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO RS +A Certification Authority DEBUG: .../IO/Socket/SSL.pm:2864: ok=1 [1] /C=GB/ST=Greater Manchester +/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Certification Authority/ +C=US/ST=TX/L=Houston/O=cPanel, Inc./CN=cPanel, Inc. Certification Aut +hority DEBUG: .../IO/Socket/SSL.pm:2864: ok=1 [0] /C=US/ST=TX/L=Houston/O=cPa +nel, Inc./CN=cPanel, Inc. Certification Authority/CN=box826.bluehost. +com DEBUG: .../IO/Socket/SSL.pm:2911: did not get stapled OCSP response DEBUG: .../IO/Socket/SSL.pm:897: done Net::SSLeay::connect -> -1 DEBUG: .../IO/Socket/SSL.pm:907: ssl handshake in progress DEBUG: .../IO/Socket/SSL.pm:917: waiting for fd to become ready: SSL w +ants a read first DEBUG: .../IO/Socket/SSL.pm:937: socket ready, retrying connect DEBUG: .../IO/Socket/SSL.pm:894: call Net::SSLeay::connect DEBUG: .../IO/Socket/SSL.pm:897: done Net::SSLeay::connect -> 1 DEBUG: .../IO/Socket/SSL.pm:952: ssl handshake done Net::SMTPS=GLOB(0x5609e794aac0)>>> EHLO localhost.localdomain Net::SMTPS=GLOB(0x5609e794aac0)<<< 250-ddd.com Hello dsl-ip.fuse.net [ +ipaddr] Net::SMTPS=GLOB(0x5609e794aac0)<<< 250-SIZE 52428800 Net::SMTPS=GLOB(0x5609e794aac0)<<< 250-8BITMIME Net::SMTPS=GLOB(0x5609e794aac0)<<< 250-PIPELINING Net::SMTPS=GLOB(0x5609e794aac0)<<< 250-AUTH PLAIN LOGIN Net::SMTPS=GLOB(0x5609e794aac0)<<< 250 HELP Net::SMTPS=GLOB(0x5609e794aac0)>>> AUTH PLAIN -stuff here Net::SMTPS=GLOB(0x5609e794aac0)<<< 535 Incorrect authentication data Could not authenticate

It has been a long time since I did any programming and I am not sure how to proceed to fix this. Any thoughts welcome and Thanks


In reply to sending email with starttls not working by jfwell

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2022-08-17 14:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?