Skip to content
Frank Bauernöppel edited this page Jan 12, 2019 · 5 revisions

sending email from Raspi

msmtp

msmtp is a an email transfer agent with a sendmail like command line interface.

If not already present in your Yocto image, it can be bitbaked by bitbake msmtp and installed from the generated package.

configuration file

The following user specific config file ~/.msmtprc was used for testing (but some sensitive info was replaced by stars):

defaults
auth    plain
tls     on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile ~/.msmtp.log

account default
host    smtp.strato.de
port    587
from    *****@************.***
user    *****@************.***
password        ***************

test email

The following email was sent for testing. Again, sensitive info (recipient's email address) was replaced by stars:

root@raspberrypi3:~# echo "Hi dude" | sendmail -d *****@************.***

Note that sendmail is a link to msmtp.

The -d (debug) option displays useful debug info on the screen. It should be omitted for regular use. The log file contains summary info about the emails sent.

Note that the email sender's password on the SMTP server is contained as plaintext in the config file. It is possible to avoid this, see the links below.

See also

Clone this wiki locally