Sending email to gmail from cron

0

Looking for help sending email to a gmail address from my cron. At the top of crontab

MAILTO="obfuscated@gmail.com"

But no mail comes. Checking /var/log/maillog, I see

Dec 17 22:46:36 myserver postfix/pickup[30426]: CC21261C6E: uid=501 from=<root>
Dec 17 22:46:36 myserver postfix/cleanup[30486]: CC21261C6E: message-id=<20181217224636.CC21261C6E@myserver.novalocal>
Dec 17 22:46:36 myserver postfix/qmgr[11071]: CC21261C6E: from=<root@myserver.novalocal>, size=5920, nrcpt=1 (queue active)
Dec 17 22:46:37 myserver postfix/smtp[30488]: connect to gmail-smtp-in.l.google.com[2607:f8b0:400e:c03::1b]:25: Network is unreachable
Dec 17 22:46:37 myserver postfix/smtp[30488]: CC21261C6E: enabling PIX workarounds: disable_esmtp delay_dotcrlf for gmail-smtp-in.l.google.com[74.125.197.26]:25
Dec 17 22:46:37 myserver postfix/smtp[30488]: CC21261C6E: to=<obfuscated@gmail.com>, relay=gmail-smtp-in.l.google.com[74.125.197.26]:25, delay=221, delays=220/0.02/0.34/0.39, dsn=2.0.0, status=sent (250 2.0.0 OK 1545086797 31si11773098plk.310 - gsmtp)
Dec 17 22:46:37 myserver postfix/qmgr[11071]: CC21261C6E: removed

So, clearly, the IPv6 version is blocked, but the fallback gets a success message, yet no mail ever arrives. Same messages if I try using the command-line mail command. However, I can use the command-line mail program to successfully send mail to my company email address.

mail -s "test1" obfuscated@mycompany.com
test1
EOT

The telnet trick seems to indicate I can access the gmail server:

$ telnet gmail-smtp-in.l.google.com 25
Trying 108.177.98.26...
Connected to gmail-smtp-in.l.google.com.
Escape character is '^]'.
220 *************************************************
^]

telnet> quit
Connection closed.

My IP tables look like this

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED 
ACCEPT     icmp --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh 
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:http 
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited 

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited 

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Any help on this will be greatly appreciated.

rcrews

Posted 2018-12-18T23:24:20.097

Reputation: 36

1gmail dropping it due to spam, etc? can gmail connect back to you to send an "undeliverable" message? Can you send yourself gmail the same way using mail that works for your work email account? – ivanivan – 2018-12-18T23:31:07.950

Complain to gmail as recipient. – AnFi – 2018-12-18T23:49:28.390

Answers

0

Thank you @ivanivan. Gmail was organizing all my cron output into the Spam folder, which is not displayed in the Gmail interface by default. (This seems like the right thing to be doing since the sender "root@myserver.novalocal" is pretty sketchy.) Once I displayed the Spam folder and looked inside, I saw all the cron output. (Look at me telnet'ing into mail servers and reviewing iptables.) Doh! ... Thank you again ever so much.

rcrews

Posted 2018-12-18T23:24:20.097

Reputation: 36