Mar 12, '07 07:30:00AM • Contributed by: robelkin
With my new ISP, they have this annoying habit of blocking any emails that look like they are coming from an SMTP server that is not their own. Obviously, so they do not get spammers blacklisting them, and hence not even their SMTP servers would be allowed to send mail, or their mail would not be accepted. This poses an issue for tech savvy people who may know what they are doing, but are being punished for knowing how things work.
Hence, I stopped getting my emails to say how the sync had gone. After getting annoyed by this, I started to look into it further. It seemed that if I was on a different network, for example my university one, and the job ran, the email would not get through -- at least not until I got home, at which point I would receive the email (the other network was blocking all smtp email; it is smarter than my ISP).
After examining the headers of the email I did receive, I noticed that the "from" address was not the normal root@robs-powerbook.local, but had rather taken on the domain of the network I was on. You can see where this is going. If you use the -r command in the mail command when piping information to it in cron, you will get a senders address that you specify. So here is my modified command (line breaks added for readability; enter as one long line):
sh /Users/rob/bin/backupjoyent.sh 2>&1 |
mail -s "Daily Backup to joyent report" my@domain.name
-r sender@address.here
If you set the two email addresses to be the same thing, i.e. the email address you want to send to, you should get an email from yourself every time it is run. This may not work on all hosts, but it may help with some!
