Net::S...ntained(3pm)

πŸ“¦
version 0.24 Β· 5 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

πŸ’– Net::S...ntained β€” the Perl manual page, but make it cute πŸ’–

okay bestie, so this is a User Contributed Perl Documentation page, and the module's full name is Net::SMTP::TLS::ButMaintained. Long name, big energy, and it is DEPRECATED β€” the page literally says use Net::SMTPS instead. We'll get to that. Sit down, grab a strawberry πŸ“, and let's go.


✨ NAME ✨

Net::SMTP::TLS::ButMaintained β€” an SMTP client that supports TLS and AUTH. And yes, the official subtitle is: DEPRECATED, use Net::SMTPS instead. She's retiring, bestie, but she still serves πŸ’…


🌸 VERSION 🌸

version 0.24


πŸŽ€ SYNOPSIS πŸŽ€

 use Net::SMTP::TLS::ButMaintained;
 my $mailer = Net::SMTP::TLS::ButMaintained->new(
        'your.mail.host',
        Hello   =>      'some.host.name',
        Port    =>      25, #redundant
        User    =>      'emailguy',
        Password=>      's3cr3t');
 $mailer->mail('emailguy@your.mail.host');
 $mailer->to('someonecool@somewhere.else');
 $mailer->data;
 $mailer->datasend("Sent thru TLS!");
 $mailer->dataend;
 $mailer->quit;

like. that's the whole vibe. construct, mail, to, data, datasend, dataend, quit. iconic honestly πŸ¦‹


πŸ’œ DESCRIPTION πŸ’œ

DEPRECATED! Please use Net::SMTPS instead. fr fr, this is the loudest part of the whole page and I'm not gonna soften it πŸ™ˆ

Net::SMTP::TLS::ButMaintained is forked from Net::SMTP::TLS. Blame "Evan Carroll" for the idea. :) (their words, not mine, I'm just the messenger 🫢)

So what is she? Net::SMTP::TLS::ButMaintained is a TLS and AUTH capable SMTP client, and the interface is gonna feel so familiar if you've used Net::SMTP. That said β€” she implements a subset of the methods that module provides. Definitely not (yet) a complete mirror image of that API. No cap. She's doing her best and her best is a subset 🌈

The methods she does support are the ones used in the example up there. Most of them are pretty self explanatory, ngl, but if you're unclear, go read the perldoc for Net::SMTP. It's giving "read the other manual, bestie."

Now, the differences in the methods provided, because this is the important part:

  • The mail method does not take the options list that Net::SMTP takes.
  • The to method also does not take options, and it is the only method available to set the recipient β€” unlike the many synonyms Net::SMTP hands you. One method, one job, no drama πŸ’…
  • The constructor takes a limited number of Net::SMTP's parameters. The constructor for Net::SMTP::TLS::ButMaintained takes the following β€” and heads up, this is in addition to the hostname of the mail server, which must be the first parameter and is not explicitly named:
    • NoTLS β€” in the unlikely event that you need to use this class to do non-TLS SMTP (and honestly you ought to be using Net::SMTP itself for that...), this turns off TLS when you supply it with a true value. Warning bestie: this will most often cause an error related to authentication when used on a server that requires TLS ⚠️
    • Hello β€” hostname used in the EHLO command
    • Port β€” port to connect to the SMTP service (defaults to 25)
    • Timeout β€” Timeout for initial socket connection (defaults to 5, passed directly to IO::Socket::INET)
    • User β€” username for SMTP AUTH
    • Password β€” password for SMTP AUTH

πŸ” TLS and AUTHentication πŸ”

During construction of a Net::SMTP::TLS::ButMaintained instance, the full login process will occur. Like, immediately. No waiting around. Here's the order of operations, bestie:

  1. Send EHLO to the server.
  2. Initiate a TLS session through STARTTLS.
  3. Once that's done, the module attempts to log in using the credentials supplied by the constructor β€” if such credentials have been supplied. No creds, no login attempt, that's the deal.

The AUTH method depends on the features the server returns after the EHLO command. Based on that, CRAM-MD5 will be used if available, followed by LOGIN, followed by PLAIN. Priority order, she's decisive πŸ’…

please note that LOGIN is the only method of authentication that has been tested. The CRAM-MD5 and PLAIN login functionality was taken directly from the script mentioned in the acknowledgements section β€” however, those have not been tested personally. So like... fair warning 🫣

😭 ERROR HANDLING 😭

This module will croak in the event of an SMTP error. It does not do gentle. It does not do subtle. It croaks.

Should you wish to handle this gracefully in your application, you may wrap your mail transmission in an eval {} block and check $@ afterward. That's the move. Protect your vibe, protect your app πŸ›‘οΈ

πŸ™ ACKNOWLEDGEMENTS πŸ™

This code was blatantly plagiarized from Michal Ludvig's smtp-client.pl script. Their words!! See <http://www.logix.cz/michal/devel/smtp> for his excellent work. Genuinely excellent work, we stan πŸ‘‘

Improvements courtesy of Tomek Zielinski β€” thank you for your service 🫢


πŸ‘‘ AUTHORS πŸ‘‘

  • Alexander Christian Westholm <awestholm at verizon dawt net>
  • Fayland Lam <fayland@gmail.com>

This software is copyright (c) 2011 by Alexander Christian Westholm, Fayland Lam.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.


and that's the whole page, bestie!! πŸŽ€ this one came from perl v5.26.2, dated 2018-08-27, and it's part of the User Contributed Perl Documentation. now go use Net::SMTPS instead, okay? ily, bye πŸ’–βœ¨

πŸ“¦ where this page comes from