framps / raspiBackup

Create and keep multiple backup versions of your running Raspberries
https://raspibackup.linux-tips-and-tricks.de
GNU General Public License v3.0
811 stars 74 forks source link

Sender's email Address not changing in the email header #619

Closed AN1MATEK closed 1 year ago

AN1MATEK commented 1 year ago

Hello there,

Thank you very much for this plug-in. I found an issue I thought I may share with you.

The -F backup runs smoothly, but I was getting an error message for the Email notification. I read about FAQ47, I still think the issues lays not with my configuration.

My email provider (Infomaniak) hard checks the sender email, it has to be registered. I successfully created an alias that is also used in SSMTP, so the sent emails are being translated to "raspberry@mydomain.de" (r@@@e). I added the corresponding configuration in the raspiBackup file (DEFAULT_SENDER_EMAIL), so it is forced to used this email.

I still get the error that the sender's email is invalid. I do think I have to check it with you, because otherwise SSMPT works very well without any extra parameters.

When debugging SSMTP and checking the email's header, I see the following (domains redacted) raspibackup.log

...
Feb 20 08:38:04 rpi sSMTP[9960]: MAIL FROM:<**root@mydomain.de**>
Feb 20 08:38:04 rpi sSMTP[9960]: 250 2.1.0 Ok
Feb 20 08:38:04 rpi sSMTP[9960]: RCPT TO:<me@mydomain.de>
Feb 20 08:38:04 rpi sSMTP[9960]: 250 2.1.5 Ok
Feb 20 08:38:04 rpi sSMTP[9960]: DATA
Feb 20 08:38:04 rpi sSMTP[9960]: 354 End data with <CR><LF>.<CR><LF>
Feb 20 08:38:04 rpi sSMTP[9960]: Received: by mydomain.de (sSMTP sendmail emulation); Mon, 20 Feb 2023 08:38:03 +0100
Feb 20 08:38:04 rpi sSMTP[9960]: Date: Mon, 20 Feb 2023 08:38:03 +0100
Feb 20 08:38:04 rpi sSMTP[9960]: To: me@mydomain.de
Feb 20 08:38:04 rpi sSMTP[9960]: From: **raspberry@mydomain.de**
Feb 20 08:38:04 rpi sSMTP[9960]: Subject: rpi: Backup finished successfully.
...

As you see, the email is actually sent from "root" in the header and masking it as "raspberry" in the body.

Troubleshooting this issue I found the workarounds, it is no longer a problem, but as a good Samaritan, I think actually changing the address in the header is the intended functionality and may help others in the future.

I attach the logs so you can see the error message from the email server.

Thank you for this awesome utility :)

framps commented 1 year ago

Thank you very much for this plug-in.

Which plugin?

I found an issue I thought I may share with you.

Great :+1: Thank you very much.

As you see, the email is actually sent from "root" in the header and masking it as "raspberry" in the body.

I'm a noob regarding eMail handling.

Troubleshooting this issue I found the workarounds,

Would be great if you share your workaround. This maybe enable me to create a fix :wink:

AN1MATEK commented 1 year ago

I meant app lol. Sorry, I lurke too much into smarthome "plug-ins" :)

There was the possibility of creating a alias for root@mydomain.de on the server side but I didn't like that. I went on and modified the /etc/ssmtp/revaliases file to force the conversion of the address that raspiBackup was trying to use into what I originally wanted. It looks something like this:

 GNU nano 5.4                                                /etc/ssmtp/revaliases
# sSMTP aliases
#
# Format:       local_account:outgoing_address:mailhub
#
# Example: root:your_login@your.domain:mailhub.your.domain[:port]
# where [:port] is an optional port number that defaults to 25.

root:raspberry@mydomain.de:mail.infomaniak.com

I should have posted the solution in the original post!

framps commented 1 year ago

Thank you very much for your explanation of your workaround :+1:

github-actions[bot] commented 1 year ago

This issue is considered stale now and will be closed automatically in 1 week if there is no activity any more