1

I now have this setup in postfix:

sudo nano main.cf
inet_interfaces = loopback-only
relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CApath = /etc/ssl/certs
smtp_use_tls = yes

Sudo nano sasl_password
[smtp.gmail.com]:587    user:password

And if I run the command:

echo "Test mail thingy" | mail -s "Test Postfix Subject" R*******@gmail.com

Does it work :)

How do i force postfix to send message to root local to my mail ?

1
  • First of all I am a Linux noob but I want a system that sends me an email in case there are problems on the server such as if it unmount a drive a service goes down or else :) Jan 25, 2019 at 17:07

1 Answer 1

0

Add the following line to /etc/aliases:

root: [email protected]

If there's an existing alias for root, place a # in front of it to comment it out. If you want it sent to multiple users, you can specify multiple addresses like this:

root: [email protected], [email protected]

After editing /etc/aliases, apply it with sudo newaliases.

Addendum: It did not work, as per comments, because postfix was not configured to accept mail bound for rene-desktop, which was the local host name.

This was fixed by adding

 mydestionation = rene-desktop

near the top of /etc/postfix/main.cf.

11
  • Thank you When i run this to test : mail -s "Test Email for Root $(date)" root <<< "This is a test email." Jan 25, 2019 at 18:14
  • Your message was not delivered to the root@rene-desktop because the domain rened-esktop was not found. Check if there are spelling errors or excess spaces and try again. - I think its because I made a mistake at the beginning of the postfix installation how do I correct this :)? Jan 25, 2019 at 18:17
  • What's the local hostname, and what's /etc/mailname containing?
    – vidarlo
    Jan 25, 2019 at 18:19
  • rene-desktop :) - I dont have that folder "/etc/mailname" Jan 25, 2019 at 18:21
  • Does mail root@localhost work?
    – vidarlo
    Jan 25, 2019 at 18:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .