solderdot
Posts: 25
Joined: Wed Oct 09, 2019 2:11 pm

SSMTP I wonder where I can actually specify the sender address

Tue Oct 22, 2019 10:16 am

but for me the solution was at the end in this two simple things:

1. the password should have only used a-z, A-Z, 0-9 (thanks to pcmanbob for this hint)
2. change FromLineOverride=YES to FromLineOverride=NO in the ssmpt.conf

hope i could help others with the same problem
Which eMail provider do you use? Google? For me, trying to use GMX (like in the original post of this thread) this does not work. I always get "Sendmail: 550 Sender address is not allowed".

I wonder where I can actually specify the sender address. Is it not the entry "root" in the ssmtp.conf file?

My ssmtp.conf file looks as follows:

Code: Select all

[email protected]
mailhub=mail.gmx.de:587
rewriteDomain=gmx.de
hostname=raspberrypi
FromLineOverride=NO
[email protected]
AuthPass=1234Password
UseSTARTTLS=YES
UseTLS=YES
Any suggestions?

pcmanbob
Posts: 7285
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: SSMTP I wonder where I can actually specify the sender address

Tue Oct 22, 2019 12:55 pm

Taken from the manual page here : https://linux.die.net/man/8/ssmtp
Reverse Aliases
A reverse alias gives the From: address placed on a user's outgoing messages and (optionally) the mailhub these messages will be sent through. Example:

root:[email protected]:mail.isp.com

Messages root sends will be identified as from [email protected] and sent through mail.isp.com.
May be that's what you need to add to your config file, I am guessing as I always just use gmail with an account setup just for use with my pi's
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

epoch1970
Posts: 3875
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: SSMTP I wonder where I can actually specify the sender address

Tue Oct 22, 2019 1:08 pm

Perhpas switching to msmtp is best.
https://www.raspberrypi.org/forums/view ... &p=1498580
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

solderdot
Posts: 25
Joined: Wed Oct 09, 2019 2:11 pm

Re: SSMTP I wonder where I can actually specify the sender address

Wed Oct 23, 2019 9:09 am

Hey guys,
thanks! I did not read beforehand that ssmtp was deprecated. Switching to msmtp did the trick.
I used the following sequence to get it up and running:

Code: Select all

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install msmtp msmtp-mta mailutils
nano ~/.msmtprc
content of ~/.msmtprc:

Code: Select all

# Set default values for all following accounts.
defaults

# Use the mail submission port 587 instead of the SMTP port 25.
port 587

# Always use TLS.
tls on

# Set a list of trusted CAs for TLS. The default is to use system settings, but
# you can select your own file.
tls_trust_file /etc/ssl/certs/ca-certificates.crt

# If you select your own file, you should also use the tls_crl_file command to
# check for revoked certificates, but unfortunately getting revocation lists and
# keeping them up to date is not straightforward.
#tls_crl_file ~/.tls-crls

# Mail account
# TODO: Use your own mail address
account [email protected]

# Host name of the SMTP server
# TODO: Use the host of your own mail account
host mail.gmx.net

# As an alternative to tls_trust_file/tls_crl_file, you can use tls_fingerprint
# to pin a single certificate. You have to update the fingerprint when the
# server certificate changes, but an attacker cannot trick you into accepting
# a fraudulent certificate. Get the fingerprint with
# $ msmtp --serverinfo --tls --tls-certcheck=off --host=smtp.freemail.example
#tls_fingerprint 00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:00:11:22:33

# Envelope-from address
# TODO: Use your own mail address
from [email protected]

# Authentication. The password is given using one of five methods, see below.
auth on

# TODO: Use your own user name fpr the mail account
user [email protected]

# Password method 1: Add the password to the system keyring, and let msmtp get
# it automatically. To set the keyring password using Gnome's libsecret:
# $ secret-tool store --label=msmtp \
#   host smtp.freemail.example \
#   service smtp \
#   user joe.smith

# Password method 2: Store the password in an encrypted file, and tell msmtp
# which command to use to decrypt it. This is usually used with GnuPG, as in
# this example. Usually gpg-agent will ask once for the decryption password.
#passwordeval gpg2 --no-tty -q -d ~/.msmtp-password.gpg

# Password method 3: Store the password directly in this file. Usually it is not
# a good idea to store passwords in plain text files. If you do it anyway, at
# least make sure that this file can only be read by yourself.
# TODO: Use the password of your own mail account
password <Password>

# Password method 4: Store the password in ~/.netrc. This method is probably not
# relevant anymore.

# Password method 5: Do not specify a password. Msmtp will then prompt you for
# it. This means you need to be able to type into a terminal when msmtp runs.

# Set a default account
# TODO: Use your own mail address
account default: [email protected]

# Map local users to mail addresses (for crontab)
aliases /etc/aliases

Code: Select all

chmod 600 ~/.msmtprc
sudo cp ~/.msmtprc /etc/msmtprc
sudo chmod 600 /etc/msmtprc
sudo nano /etc/aliases
content of /etc/aliases:

Code: Select all

sudo nano /etc/mail.rc
content of /etc/mail.rc:

Code: Select all

set sendmail="/usr/bin/msmtp -t"
That's it.
Sending eMails works fine via:

Code: Select all

echo "Hello world email body" | mail -s "Message from Raspi" [email protected]
or

Code: Select all

sudo mail -s "Mesage from Raspi" [email protected] < message.txt
I took that wisdom from this site:
https://decatec.de/linux/linux-einfach- ... mit-msmtp/
Sorry, it's German language.

Return to “Other projects”