5

I have installed Raspbian Buster with desktop on my Pi3B+ and am processing to install my apps. This is proceeding, most work allowing for newer versions, however I can't seem to send mail using ssmtp.

I installed ssmtp mailutils and configured /etc/ssmtp/revaliases and /etc/ssmtp/ssmtp.conf (as below) and ran sudo adduser pi mail

The version of ssmtp seems to be identical to that on Stretch, and I can successfully send from my Pi3A+ running Stretch, but not Buster.

I can logon to Gmail from chromium on Buster.

/etc/ssmtp/revaliases 
# sSMTP aliases
# 
# Format:   local_account:outgoing_address:mailhub
#
# Example: root:[email protected]:mailhub.your.domain[:port]
# where [:port] is an optional port number that defaults to 25.
root:[email protected]:smtp.gmail.com:587
pi:[email protected]:smtp.gmail.com:587

.

/etc/ssmtp/ssmtp.conf 
#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
[email protected]

# The place where the mail goes. The actual machine name is required no 
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtp.gmail.com:587

[email protected]
AuthPass=XXXXXXXX%XXXXXXXX
AuthMethod=LOGIN
UseTLS=YES
UseSTARTTLS=YES

# Where will the mail seem to come from?
rewriteDomain=gmail.com

# The full hostname
#hostname=

# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=YES

/var/log/mail.err shows

Jun 26 15:04:57 MilliwaysPi3Plus sSMTP[1932]:  (MilliwaysPi3Plus) 

and dead.letter shows the contents of the email

1
  • "I can't seem to send mail using ssmtp." -> So what happens? Is there an error, or does it just mysteriously not get sent?
    – goldilocks
    Jun 26, 2019 at 10:20

1 Answer 1

5

Apparently ssmtp is deprecated in Buster

I managed to get mail working by installing msmtp and msmtp-mta

msmtp --configure [email protected] outputs a suggested configuration file.

I copied this to /etc/msmtprc to create a system default and edited to include the gmail password.

It is also necessary to add an account default

The following is a simplified system config file:-

# Set default values for all following accounts.
defaults
auth           on
tls            on
tls_trust_file /etc/ssl/certs/ca-certificates.crt

# Gmail
account gmail.com
host smtp.gmail.com
port 587

from [email protected]
user XXXXXXXX.raspberry.pi
password XXXXXXXXXXXXXXXX

# Default
account default : gmail.com

Mail can now be sent using msmtp in place of ssmtp

See https://wiki.archlinux.org/index.php/Msmtp

There are examples in /usr/share/doc/msmtp/examples/

2
  • Could you please add an example for iCloud? :)
    – PascalS
    Apr 12, 2020 at 12:51
  • @PascalS Check here for iCloud settings
    – norq
    Mar 23, 2022 at 21:19

Not the answer you're looking for? Browse other questions tagged or ask your own question.