How to send an e-mail after a cron job [duplicate]
You can use the MAILTO option in crontab to define your email address and receive all output and errors in all crons running.
open crontab using
crontab -e
on the top of the file use MAILTO option as
[email protected]
cron looks for MAILTO feature to decide where it should send cron logs. it send is to root by default if the crons are running with root.
put it there on the top and remove any mail command reference from the crons.
Test and verify if you receive cron alerts after this.
On FreeBSD
1: Check log:
tail -f /var/log/cron
tail -f /var/log/maillog
2: Replace sendmail with ssmtp vi /etc/rc.conf file.. and add:
sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
3: Launch following commands:
killall sendmail
cd /usr/ports/mail/ssmtp/
make install replace clean
4: Edit ssmtp conf file:
vi /usr/local/etc/ssmtp/ssmtp.conf
.... and add following lines:
[email protected]
mailhub=smtp.example.com:465
RewriteDomain=example.org
UseTLS=YES
[email protected]
AuthPass=password222
FromLineOverride=YES
Hostname=yourhostname
5: Enter following command:
echo ‘ssmtp_enable=“YES”’ >> /etc/rc.conf
p.s. other explained options of ssmtp.conf are here:
http://www.techrepublic.com/blog/it-security/use-ssmtp-to-send-e-mail-simply-and-securely/
Problem in this case was that message had been delivered to spam folder on gmail (which is always worth checking). Adding sender as a contact should avoid this.
Apart from that, looking at the received message's full headers may give clues as to why it was flagged as spam (and so how to influence filtering not to do this).