root@fourth:~# cpanm --verbose Mail::Webmail::Gmail cpanm (App::cpanminus) 1.7044 on perl 5.032001 built for x86_64-linux-gnu-thread-multi ... Checking if you have Crypt::SSLeay 0.51 ... No ... ==> Found dependencies: Crypt::SSLeay Searching Crypt::SSLeay (0.51) on cpanmetadb ... --> Working on Crypt::SSLeay Fetching http://www.cpan.org/authors/id/N/NA/NANIS/Crypt-SSLeay-0.72.tar.gz ... OK Unpacking Crypt-SSLeay-0.72.tar.gz ... Configuring Crypt-SSLeay-0.72 ... *** THIS IS NOT AN ERROR, JUST A MESSAGE FOR YOUR INFORMATION *** Do you really need Crypt::SSLeay? Starting with version 6.02 of LWP, https support was unbundled into LWP::Protocol::https. This module specifies as one of its prerequisites IO::Socket::SSL which is automatically used by LWP::UserAgent unless this preference is overridden separately. IO::Socket::SSL is a more complete implementation, and, crucially, it allows hostname verification. Crypt::SSLeay does not support this. At this point, Crypt::SSLeay is maintained to support existing software that already depends on it. However, it is possible that your software does not really depend on Crypt::SSLeay, only on the ability of LWP::UserAgent class to communicate with sites over SSL/TLS. If are using version LWP 6.02 or later, and therefore have installed LWP::Protocol::https and its dependencies, and do not explicitly use Net::SSL before loading LWP::UserAgent, or override the default socket class, you are probably using IO::Socket::SSL and do not really need Crypt::SSLeay. Before installing Crypt::SSLeay, you may want to try specifying a dependency on LWP::Protocol::https. root@fourth:~# #### root@fourth:~# cd .ssh/ root@fourth:~/.ssh# ll total 12 drwx------ 2 root root 4096 Jan 2 02:17 ./ drwx------ 9 root root 4096 Mar 5 04:47 ../ -rw------- 1 root root 419 Jan 2 02:17 authorized_keys root@fourth:~/.ssh# #### #!/usr/bin/perl use v5.030; # strictness implied use warnings; use Email::Simple::Markdown; use Email::Sender::Simple qw(sendmail); use Email::Sender::Transport::SMTP qw(); use Try::Tiny; use Config::Tiny; my $ini_path = qw( /home/wilma/7.values.ini ); my $sub_hash = "my_smtp"; my $Config = Config::Tiny->new; $Config = Config::Tiny->read( $ini_path, 'utf8' ); # -> is optional between brackets my $host = $Config->{$sub_hash}{'host'}; my $port = $Config->{$sub_hash}{'port'}; my $username = $Config->{$sub_hash}{'sasl_username'}; my $pass = $Config->{$sub_hash}{'sasl_password'}; my $ssl = $Config->{$sub_hash}{'ssl'}; say "values are $host $port $username $ssl"; my $output = "Come here, Mr. Watson"; my $message = Email::Simple::Markdown->create( header => [ Subject => "Report", To => 'tallharry84@gmail.com', From => 'noreply@foo.com' ], body => $output ); try { sendmail( $message, { from => 'noreply@foo.com', transport => Email::Sender::Transport::SMTP->new( { host => $host, port => $port, sasl_username => $username, sasl_password => $pass, ssl => $ssl, } ) } ); } catch { warn "sending failed: $_"; }; __END__ wilma@fourth:~$ #### wilma@fourth:~$ ./1.smtp.pl values are fourth 465 wilma starttls sending failed: unable to establish SMTP connection to (fourth) port 465 #### wilma@fourth:~$ hostname fourth #### sudo apt-get install alpine postfix bsd-mailx sudo vi /etc/postfix/main.cf #=> correct "myhostname" if necessary #=> if it doesn't exist, add the line "smtp_tls_security_level = may" #=> if this option or the option "smtp_tls_CApath" doesn't exist, # add the line "smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt" sudo dpkg-reconfigure postfix # and configure as appropriate echo "root: pi" | sudo tee -a /etc/aliases && echo "---" && cat /etc/aliases sudo newaliases && sudo systemctl restart postfix echo "This is a mailx test" | mailx -s "mailx test" root alpine # Configure "User Domain" and anything else as needed