You are not logged in.
Pages: 1
I thought I would get system mail sent to my isp mail account, so I set up msmtp with all my details and sent a few emails from the command line to check that it was working OK.
No problems so far.
I installed msmtp-mta to get the sendmail links, and created an aliases file in /etc to alia root to my email account.
root: myself@myaddress
but all the emails are still sent to root instead of myself@myaddress, which generates a failuer notice from my ISP.
I notice that if a send mail with the -P option I have a line "aliases = (not set)" which seems to be a clue
Can some kind person tell me what I have done wrong?
Thanks
Andrew
Last edited by fdservices (2013-02-12 11:38:55)
Offline
Is there a configuration file you could redact and post?
I laugh, yet the joke is on me
Offline
Sure:
#Accounts will inherit settings from this section
defaults
auth login
tls off
logfile ~/msmtp.log
# First address
account account_name
host smtp.mydomain.co.uk
port 25025
from user@mydomain.co.uk
user user@mydomain.co.uk
password mypassword
# Default Account
account default : account_nameOffline
@fdservices
I don't understand the "alias" thing.
I assume that you listed the .msmtprc file in your user home directory. Its permissions are set to 600:
chmod 600 ~/.msmtprcIf you want to send e-mail during the boot time or shutdown, you will be the root user then. In order to use /home/$USER/.msmtprc you should do something like that
/usr/bin/sudo -u USER /home/USER/path/to/your/script/sendmessage.shReplace the USER with your user name.
And in the "sendmessage.sh" script you can prepare the message you want to be sent and send it.
For example
/bin/echo TEXT | /usr/bin/mail -s SUBJECT you@your.domain.ukThe TEXT could be another $script, contents of a text file, or just a simple text.
Perhaps it is much too complocated and can be made very easy, but it's what I wrote to replace my rc.local and rc.shutdown scripts when I began to use pure systemd. It sends me the current IP address and informs me when the machine is turned down. In my case e-mail is sent by a service, but you can use a different mechanism to trigger sending a message.
Offline
No, I put the configuration in /etc/msmtprc which means that it will be used by every user unless a .msmtprc file exists in the users home directory, in which case the contents of that file will override the /etc file. Also, that part works fine and I get the emails sent with one problem. If the email is sent by mailx to the root mailbox when a process has encountered an error, I receive a failure notice because the email goes to root and my mail server at the ISP does not know how to forward the email to that address. This is what the aliases file is supposed to deal with.
I put "root: myself@myaddress" into the /etc/aliases file which, according to the instructions, should mean that instead of sending the messages to root they will be sent to the alias "myself@myaddress". This is the bit that doesn't work at the moment.
Thanks for the reply
Andrew
Offline
I think I have found the answer. I added the line
aliases /etc/aliasesto the default section of the msmtprc file and now if a send mail with the -P option I have a line "aliases = /etc/aliases" in the output
I will let it run for a while to see if it is OK now and let you know.
Andrew
Offline
Thank you for the tip. It may come in handy one day.
I never gave it much thought, but I ddn't put my e-mail password into /etc/msmtprc in case it was read by another user. Unless the /etc/msmtprc file permissions have to be 600.
Offline
According to the documentation msmptrc accepts passwords in the form
passwordeval gpg -d ~/.msmtp.password.gpgThe aliases parameter worked so I am marking this as solved
Andrew
Offline
Pages: 1