Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with email notifications - subject and to fields #161

Open
AshleyHow opened this issue Sep 24, 2017 · 7 comments
Open

Issues with email notifications - subject and to fields #161

AshleyHow opened this issue Sep 24, 2017 · 7 comments

Comments

@AshleyHow
Copy link

Using CentOS7 I've found that when using the master branch any email notification sent have issues for me. Below is settings taken from config.

#EMAIL_TO="[email protected]"
EMAIL_TO="[email protected]"
EMAIL_FROM=
EMAIL_SUBJECT="DML Backup Log"
EMAIL_FAILURE_ONLY="no" # send e-mail only if there was an error while creating backup

#command to use to send mail
MAIL="mailx" # default command for Linux mail
#MAIL="mail" # for CentOS, if "mailx" fails try this one
#MAIL="ssmtp"
#MAIL="sendmail"
#MAIL="msmtp"

Using mailx has the following behaviour. Mails received do not contain any subject, nor any backup status and a separate email is sent to [email protected], [email protected] and [email protected] in addition to [email protected].

Commented mailx and uncommented mail and tried again to get the same behaviour.

Using sendmail the to field seems to work as expected now and contains the subject but does not include the backup status in subject.

This is the same in dev branch. Issue not present in stable branch.

Is this intended, am I doing something wrong or is it a bug?

Thanks.

@zertrin
Copy link
Owner

zertrin commented Sep 30, 2017

Thanks for your feedback. I have never used CentOS so I'm not sure what's happening here.

The first thing to do would be identify exactly which package provides the mailx, mail, and sendmail commands on you system. There are a variety of mail clients that provide the same command and each of them have different options and expectations about their arguments.

For this my google-fu suggest something like rpm -qf myfilename where myfilename would be the result of running which <mailcommand> for <mailcommand> in mailx, mail and sendmail.

Please update with the results to understand better what is going on here.

@AshleyHow
Copy link
Author

AshleyHow commented Sep 30, 2017

Thank for you for help on this.

Both mailx and mail use mailx-12.5-16.el7.x86_64 with sendmail using postfix-2.10.1-6.el7.x86_64

Hope this helps you.

@xmatthias
Copy link

xmatthias commented Nov 1, 2017

Does it work if you run echo "test 11" | mailx -s "test email 1" [email protected] on the command line manually?
This should send a mail with the subject "test email 1" to [email protected] (please use your email address there).
If this does not work, then mailx is not setup to send emails properly...

@AshleyHow
Copy link
Author

Running that command works absolutely fine.

@trilitheus
Copy link

trilitheus commented May 2, 2018

HI - I've been testing this on Centos7.
The problem is the case statement against ${MAIL} on line 536 of current master duplicity-backup.sh
Centos7 uses heirloom mailx but the value of MAILCMD_BASENAME is set to just 'mailx' whereas the case statement expects 'heirloom-mailx', therefore the case statement is dropping through to mailcmd_else and being called incorrectly.
If I edit the case statement at line 545 to just state mailx instead of heirloom-mailx, the correct format of mailx is called and the email comes through correctly with the subject, from and to parts of the mail set as expected.
I'd be happy to submit a pull request with this but I'm not sure if this would break anything else. Maybe a heirloom-mailx|mailx) on line 545 would add the expected behaviour without breaking any previous behaviour where this was working correctly - if it indeed was for anyone using mailx on centos!

@silverdr
Copy link

silverdr commented Jun 6, 2018

I have very similar problem on Ubuntu. It started after recent update:

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

  [email protected]
    Unrouteable address
  [email protected]
    Unrouteable address

[-- #2 12/239 message/delivery-status, 7bit, US-ASCII --]


[-- #3 66/2595 message/rfc822 --]

Date: Wed, 06 Jun 2018 12:27:38 +0000
To: [email protected], [email protected], [email protected], [email protected]
Message-Id: <[email protected]>
From: Non-root User <[email protected]>

The correct address is among the ones it tries to send to but From is incorrect, Subject is missing, and the three additional addresses are who knows where from...

Switching branches from stable to master made the problem disappear.

@danieleagle
Copy link

I'm running CentOS 8 and am using Postfix MTA. I can easily send a command using mail or mailx at the command line but when the script does it, I have the same issue as everyone else as outlined by this parent issue (e.g. no subject and multiple invalid TO: addresses).

The fix for me was to change the mail command in the config file to sendmail. It worked after that. However, if you aren't using Postfix MTA then you may have different results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants