I am using the package sendmailR to send a .csv file through RStudio on an Ubuntu build (12.04). I get completion messages in RStudio saying that everything went fine, but the message never gets delivered.
From R:
> sendmail(from=from,to=to,subject=subject,msg=bodyWithAttachment)
$code
[1] "221"
$msg
[1] "2.0.0 Bye"From Ubuntu:
$ sudo postfix status
postfix/postfix-script: the Postfix mail system is running: PID: 8576When I look at the log:
$ tail -f /var/log/mail.log
Apr 22 15:55:12 bre-dev-2 postfix/qmgr[11718]: B83F424E0140: from=<bre-dev-2@bre-dev-2>, size=1820, nrcpt=1 (queue active)
Apr 22 15:55:12 bre-dev-2 postfix/smtpd[11953]: disconnect from localhost[127.0.0.1]
Apr 22 15:55:12 bre-dev-2 postfix/smtp[11950]: connect to gmail-smtp-in.l.google.com[2607:f8b0:4001:c05::1b]:25: Network is unreachable
Apr 22 15:55:12 bre-dev-2 postfix/smtp[11950]: connect to gmail-smtp-in.l.google.com[74.125.193.27]:25: Connection refused
Apr 22 15:55:12 bre-dev-2 postfix/smtp[11950]: connect to alt1.gmail-smtp-in.l.google.com[2607:f8b0:400d:c04::1b]:25: Network is unreachable
Apr 22 15:55:12 bre-dev-2 postfix/smtp[11950]: connect to alt1.gmail-smtp-in.l.google.com[74.125.29.27]:25: Connection refused
Apr 22 15:55:12 bre-dev-2 postfix/smtp[11950]: connect to alt2.gmail-smtp-in.l.google.com[74.125.131.27]:25: Connection refused
Apr 22 15:55:12 bre-dev-2 postfix/smtp[11950]: B83F424E0140: to=<>, relay=none, delay=0.08, delays=0.07/0/0.01/0, dsn=4.4.1, status=deferred (connect to alt2.gmail-smtp-in.l.google.com[74.125.131.27]:25: Connection refused)And here is the output from postconf -n:
lias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
inet_protocols = all
mailbox_size_limit = 0
mydestination =
myhostname = bre-dev-2
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yesCould someone help me decipher what is going on here?
UPDATEHere is how the telnet looks:
bre-dev-2@bre-dev-2:~$ telnet gmail-smtp-in.l.google.com 25
Trying 74.125.193.27...
Trying 2607:f8b0:4001:c05::1a...
telnet: Unable to connect to remote host: Network is unreachable 1 Answer
Look at the very end of your log message:
connect to alt2.gmail-smtp-in.l.google.com[74.125.131.27]:25: Connection refusedIn fact all through that you're getting connection issues. This is either a network level issue or Google hates you personally. Some ISPs block direct port 25 so try telnetting to Google and see what you can see. Here's what I get:
$ telnet gmail-smtp-in.l.google.com 25
Trying 173.194.78.27...
Connected to gmail-smtp-in.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP c10si1169414wiy.16 - gsmtp
HELO
250 mx.google.com at your serviceHaving had a rummage around your profile, I can see numerous support questions on the internet from other people on your ISP that have routing issues on port 25. I strongly suspect this is them blocking outbound port 25.
You can either tunnel through another ISP or ask your ISP how you can send mail. Postfix should allow you to set a relay. Or you could even try Gmail's secure relay port (and hope your ISP doesn't also block that).
4