my $smtp = Net::SMTPS->new( $server, Port => $server_port, Debug => 1, doSSL => +$mail_sasl_type) || die "cannot connect to server ${server}"; my $sasl = Authen::SASL->new( mechanism => 'PLAIN', debug => 1, callback => {pas +s => $pass, user => $user}); $smtp->auth( $sasl ) || die "cannot do mail auth"; #### METHODS Most of all methods of Net::SMTP are inherited as is, except auth(). auth ( USERNAME, PASSWORD [, AUTHMETHOD]) Attempt SASL authentication through Authen::SASL module. AUTHMETHOD is your required method of authentication, like 'CRAM-MD5', 'LOGIN', ... etc. If your selection does not match the server-offerred AUTH mechanism, authentication negotiation may fail. #### SYNOPSIS use Authen::SASL; $sasl = Authen::SASL->new( mechanism => 'CRAM-MD5 PLAIN ANONYMOUS', callback => { pass => \&fetch_password, user => $user, } ); #### Net::SMTPS=GLOB(0x562fb253e128)<<< 250-AUTH PLAIN LOGIN CRAM-MD5 DIGEST-MD5