Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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)
[1] "221"

[1] "2.0.0 Bye"

From Ubuntu:

$ sudo postfix status
postfix/postfix-script: the Postfix mail system is running: PID: 8576

When 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[]
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[]: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[]:25: Connection refused
Apr 22 15:55:12 bre-dev-2 postfix/smtp[11950]: connect to alt2.gmail-smtp-in.l.google.com[]:25: Connection refused
Apr 22 15:55:12 bre-dev-2 postfix/smtp[11950]: B83F424E0140: to=<stuart.greenlee@gmail.com>, 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[]: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 = [::ffff:]/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 = yes

Could someone help me decipher what is going on here?

UPDATE Here is how the telnet looks:

bre-dev-2@bre-dev-2:~$ telnet gmail-smtp-in.l.google.com 25
Trying 2607:f8b0:4001:c05::1a...
telnet: Unable to connect to remote host: Network is unreachable
share|improve this question

1 Answer 1

up vote 2 down vote accepted

Look at the very end of your log message:

connect to alt2.gmail-smtp-in.l.google.com[]:25: Connection refused

In 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
Connected to gmail-smtp-in.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP c10si1169414wiy.16 - gsmtp
250 mx.google.com at your service

Having 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).

share|improve this answer
maybe google hates me :(.. i posted the output from telnet. when I enter the telnet code it trys to conect to a different IP. –  Stu Apr 23 '14 at 13:02
Can you ping those resolved addresses? If you can, it's most likely a ISP-level block. –  Oli Apr 23 '14 at 13:05
Yup, the issue appears to be that I have no relayhost. Working on that now, will post update soon. –  Stu Apr 23 '14 at 13:27
Okay, issue resolved. I had to set up the relayhost as in the link you posted. Thanks! –  Stu Apr 23 '14 at 13:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.