Mail-Make
view release on metacpan or search on metacpan
connection is attempted, so configuration errors are reported
immediately without consuming network resources.
Recognised options:
"AuthMechanisms"
Space-separated list of SASL mechanism names in preference order.
Defaults to "PLAIN LOGIN", which are safe and universally supported
over an encrypted channel (STARTTLS or SSL).
The actual mechanism used is the intersection of this list and what
the server advertises. If no intersection exists, deprecated
challenge-response mechanisms ("DIGEST-MD5", "CRAM-MD5", "GSSAPI")
are excluded and the remainder of the server's list is tried.
"Debug"
Boolean. Enables Net::SMTP debug output.
"Hello"
The FQDN sent in the EHLO/HELO greeting.
"Host"
Hostname, IP address, or an already-connected Net::SMTP object. If
an existing object is passed, it is used as-is and not quit on
completion (the caller retains ownership of the connection).
If omitted, the colon-separated list in $ENV{SMTPHOSTS} is tried
first, then "mailhost" and "localhost" in that order.
"MailFrom"
The envelope sender address ("MAIL FROM"). Defaults to the bare
addr-spec extracted from the "From:" header.
"Password"
Password for SMTP authentication. May be:
* A plain string.
* A "CODE" reference called with no arguments at authentication
time.
Useful for reading credentials from a keyring or secrets manager
without storing them in memory until needed:
Password => sub { MyKeyring::get('smtp') }
"Port"
SMTP port number. Common values:
* 25 - plain SMTP (default when "SSL" is false)
* 465 - SMTPS, direct SSL/TLS (use with "SSL => 1")
* 587 - submission, usually STARTTLS (use with "StartTLS => 1")
"SSL"
Boolean. When true, the connection is wrapped in SSL/TLS from the
start (SMTPS, typically port 465).
Requires IO::Socket::SSL.
"StartTLS"
Boolean. When true, a plain connection is established first and then
upgraded to TLS via the SMTP "STARTTLS" extension (typically port
587).
Requires IO::Socket::SSL. Ignored when "Host" is a pre-built
Net::SMTP object.
"SSL_opts"
Hash reference of additional options passed to IO::Socket::SSL
during the SSL/TLS handshake. For example:
SSL_opts => { SSL_verify_mode => 0 } # disable peer cert check
SSL_opts => { SSL_ca_file => '/etc/ssl/ca.pem' }
"Timeout"
Connection and command timeout in seconds, passed directly to
Net::SMTP.
"To", "Cc", "Bcc"
Override the RCPT TO list. Each may be a string or an array
reference of addresses. When omitted, the corresponding message
headers are used.
"Bcc:" is always stripped from the outgoing message headers before
transmission, per RFC 2822 §3.6.3.
"Username"
Login name for SMTP authentication (SASL). Requires Authen::SASL.
Must be combined with "Password". Validated before any connection is
made.
Typical usage examples:
# Plain SMTP, no auth (LAN relay)
$mail->smtpsend( Host => 'mail.example.com' );
# SMTPS (direct TLS, port 465)
$mail->smtpsend(
Host => 'smtp.example.com',
Port => 465,
SSL => 1,
Username => 'jack@example.com',
Password => 'secret',
);
# Submission with STARTTLS (port 587) and password callback
$mail->smtpsend(
Host => 'smtp.example.com',
Port => 587,
StartTLS => 1,
Username => 'jack@example.com',
Password => sub { MyKeyring::get('smtp_pass') },
);
Returns the list of accepted recipient addresses in list context, or a
reference to that list in scalar context.
If an error occurs, it sets an exception object, and returns "undef" in
scalar context, or an empty list in list context.
use_temp_file( [$bool] )
When true, "as_string_ref" always spools to a temporary file regardless
of message size. Useful when you know the message will be large, or when
you want to bound peak memory use unconditionally. Default: false.
GPG METHODS
These methods delegate to Mail::Make::GPG, which requires IPC::Run and a
working "gpg" (or "gpg2") installation. All three methods produce RFC
( run in 2.585 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )