Cron – let CRON send emails through SMTP ( debian squeeze )

croneximsmtp

i would like to send emails whenever a cronjob has completed, i read that this is possible with exim4.

in /etc/alias i added the line
myuser: mygmail@gmail.com

in /etc/exim4/update-exim4.conf.conf 
i set dc_smarthost='smtp.myserver.ip::25

and in /etc/exim4/passwd.client i set

smtp.myserver.ip:login@my.domain:mypassword

my problem is that i can't see any login at my mailserver, and in the exim logs i saw a few lines with

2012-10-13 09:17:01 1TMvy1-0001fp-F2 ** mygmail@gmail.com R=nonlocal: Mailing to remote domains not supported
2012-10-13 09:17:01 1TMvy1-0001fr-JE <= <> R=1TMvy1-0001fp-F2 U=Debian-exim P=local S=17426

are there any additional config settings i have to set?

edit : i solved the prev. error by running dpkg-reconfigure, but now i'm facing the following error

<root@debian> R=dnslookup T=remote_smtp defer (-53): retry time not reached for any host

Best Answer

You need to reconfigure your exim4 configuration to be an internet mailer:

dpkg-reconfigure exim4-config

Use the instructions starting in section 2 of the Debian Exim4 readme at http://pkg-exim4.alioth.debian.org/README/README.Debian.html. Section 2.1.1.1 describes the different types of configuration.

You seem to have it set to "local delivery only; not on a network", that needs to be changed to one of the internet style mail servers, pick the one that works best for you. By your description, it sounds like you want "mail sent by smarthost; no local mail".