teeth_03
Posts: 284
Joined: Sat Sep 08, 2012 12:02 am

SMTP Server DNS error

Mon Jul 01, 2013 11:39 am

I configured my Pi to alert me if there are any hard drive errors with my NasberryPi setup. One of the side effects, is that now everyday, rsync wants to email me with the list of files that it synced. The problem is, something with the DNS isn't configured right because it sends me an email, then gmail then sends a Delivery Failed notification because somehow, its trying to email [email protected] (my email is @gmail but that isn't it).

I actually have been trying to get it to send to my hot mail address instead by putting root=my [email protected] in the SMTP config, but that doesn't seem to be working.

Are there any things I should try looking at? I guess what I really need to do, is forward the pi user to my email instead of root, how would I do that, pi= in the SMTP config?

geekinthesticks
Posts: 97
Joined: Fri Feb 08, 2013 7:22 pm

Re: SMTP Server DNS error

Mon Jul 01, 2013 12:18 pm

You didn't say which smtp server you were using. However, the following works for most:

Create /etc/aliases

Add:
Update the alias file:

Code: Select all

newaliases

teeth_03
Posts: 284
Joined: Sat Sep 08, 2012 12:02 am

Re: SMTP Server DNS error

Mon Jul 01, 2013 12:59 pm

I have it configured to use gmail's servers

geekinthesticks
Posts: 97
Joined: Fri Feb 08, 2013 7:22 pm

Re: SMTP Server DNS error

Mon Jul 01, 2013 2:48 pm

I meant which SMTP server are you using on the Pi e.g. Postfix. If it's sendmail compatible, as most mailservers tend to be, my suggestion above would work.

teeth_03
Posts: 284
Joined: Sat Sep 08, 2012 12:02 am

Re: SMTP Server DNS error

Mon Jul 01, 2013 9:58 pm

I used ssmtp

geekinthesticks
Posts: 97
Joined: Fri Feb 08, 2013 7:22 pm

Re: SMTP Server DNS error

Tue Jul 02, 2013 10:07 am

Have a look at https://wiki.archlinux.org/index.php/SSMTP . It's for ArchLinux, but should give you the information you need.

User avatar
alexanderre
Posts: 19
Joined: Fri Mar 04, 2016 4:51 pm
Location: Kyiv, Ukraine
Contact: Facebook

Re: SMTP Server DNS error

Fri Mar 04, 2016 4:52 pm

The problem is that after you set /etc/aliases and tell system to use them it says the following:
newaliases: Aliases are not used in sSMTP :|

User avatar
alexanderre
Posts: 19
Joined: Fri Mar 04, 2016 4:51 pm
Location: Kyiv, Ukraine
Contact: Facebook

Re: SMTP Server DNS error

Sat Mar 05, 2016 9:18 am

The problem I face is that despite the fact I've tried to change hostname in /etc/ssmtp/ssmtp.conf from localhost to smtp.gmail.com, gmail.com and even RaspberryPi I still get mails generated and sent for either root or pi users to [email protected] or [email protected] via mailx.

I've also added pi and postmaster just in case to /etc/ssmtp/revaliases - nothing changed.

At the same time in case of any system alerts I for some reason after installing ssmtp and mailutils started to receive delivery failure reports on my gmail inbox telling me that my RPi is trying to send mails to [email protected]

Where is that setting that will help to put all of this to work as one? Why mailx generates adresses for local users @raspberrypi, while some system reporting service uses [email protected]? :x

User avatar
alexanderre
Posts: 19
Joined: Fri Mar 04, 2016 4:51 pm
Location: Kyiv, Ukraine
Contact: Facebook

Re: SMTP Server DNS error

Sat Mar 05, 2016 10:52 am

Thanks to Ira Finch for the hint: http://www.cyberciti.biz/faq/linux-unix ... -settings/

I had a backup cron and whenever something went wrong crontab tried to email me about it.
Since I'am pi and rewriteDomain in /etc/ssmtp/ssmtp.conf is set to gmail.com - it attempted to send an email to [email protected]

Hoverer there is an internal MAILTO variable for crontab and it's using it for rcpt address. It was missing in my crontab file, so I just added it like this:
MAILTO=[email protected]

right above my cron jobs and saved the file.

To check if it works I unmounted my USB drive that is set to store backups and set a new cron job in two minutes to see if it works. When crontab has failed to reach USB drive I got a proper email, so it is now fixed for me. Maybe you guys should also look into crontab jobs more closely :idea:

Return to “Networking and servers”