Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Net::SMTP in the 21st Century

by samwyse (Scribe)
on Nov 18, 2013 at 15:33 UTC ( #1063126=perlquestion: print w/replies, xml ) Need Help??

samwyse has asked for the wisdom of the Perl Monks concerning the following question:

Back in the day, I could telnet to my local SMTP server and easily forge emails, to the amazement of my friends and colleagues. This week, I'm trying to get a web service to send an email verification email, and nothing is working. Right now, I'm using my laptop, and I've tried while both on and off my company's network, connecting to the server specified in my Exchange settings, my company's public MX record, and my home ISP's MX record. For all three, Net::SMTP returns undef, with no messages despite having debug tuned on, Mail::Sendmail is the same, and I can't even connect using telnet to port 23. For what it's worth, my Exchange server settings include "Logon network security: Negotiate Authentication". And while I'll be asking my company's IT staff, I thought I'd leave some breadcrumbs here for future seekers.

Replies are listed 'Best First'.
Re: Net::SMTP in the 21st Century
by daxim (Curate) on Nov 18, 2013 at 16:01 UTC
    Don't bother starting to automate with Perl (Email::Sender is super sweet) until you can get a successful SMTP session manually. This decade's best practice: encryption, authentication, submission port. Try variations of this:
    $ echo '\000mysmtpusername\000mysmtppassword' | openssl base64
    $ # ↑↑↑↑ copy this to clipboard
    $ openssl s_client -connect -starttls smtp
    auth login XDAwMG15c210cHVzZXJuYW1lXDAwMG15c210cHBhc3N3b3JkCg==
    and you know the rest:
    mail from: <>
    rcpt to: <>
Re: Net::SMTP in the 21st Century
by hippo (Chancellor) on Nov 18, 2013 at 15:41 UTC

    You might have more luck using telnet to port 25, since that is the SMTP port (23 is the telnet server port and is likely to be closed or firewalled anyway). In fact, if you did that first, your client address may be blacklisted as a result, which could be why you are getting nothing back. Just a thought.

Re: Net::SMTP in the 21st Century
by kschwab (Vicar) on Nov 18, 2013 at 17:45 UTC

    I assume this is because your ISP is blocking outbound port 25...many of them do. They do this mostly to keep botnets from spamming people.

    One option would be to create a gmail account and use it to relay the email. Gmail's SSL-enabled SMTP servers listen on port 465, which may not be blocked. CPAN has Email::Send::Gmail, or you could configure a local sendmail/postfix/whatever instance to relay it. Also, if having the notification come from a address isn't desirable, you can use your own domains if you have a Google Apps account.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1063126]
Approved by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2020-11-28 04:52 GMT
Find Nodes?
    Voting Booth?

    No recent polls found