Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to send emails from my Debian 6 server. I only want to send. I've followed every set of instructions I can find for Sendmail, Exim4 and Postfix and can not get any working. I tried the SMTP Authentication Support module to send mail through a Gmail account. But then that suddenly stopped working too. The test email that I can send via the module's configuration form works, but trying to send via drupal_mail() fails.

mail -v reports that the message was accepted for delivery, but the mail never arrives in my inbox. Below is the output. I was thinking that maybe the issue was with the MAIL From: travis@debian, but everything I've tried to change that with is failing as well. I've changed /etc/email-addresses and added a rewrite rule with an f flag to change the from header, to no avail. Anyway, the output:

turibe@servername:~$ mail -v
Subject: Testing
EOT Connecting to [] via relay...
220 ESMTP Sendmail 8.14.3/8.14.3/Debian-9.4; Thu, 30 May 2013 00:53:01 -0700; (No UCE/UBE) logging access from: localhost(OK)-localhost []
>>> EHLO Hello localhost [], pleased to meet you
250 HELP
>>> VERB
250 2.0.0 Verbose mode
>>> MAIL From:<> SIZE=218
250 2.1.0 <>... Sender ok
>>> RCPT To:<>
>>> DATA
250 2.1.5 <>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
050 <>... Connecting to via esmtp...
050 220 ESMTP zb4si24120260obb.80 - gsmtp
050 >>> EHLO
050 at your service, [2600:3c00::f03c:91ff:fe70:4335]
050 250-SIZE 35882577
050 250-8BITMIME
050 250-STARTTLS
050 >>> STARTTLS
050 220 2.0.0 Ready to start TLS
050 >>> EHLO
050 at your service, [2600:3c00::f03c:91ff:fe70:4335]
050 250-SIZE 35882577
050 250-8BITMIME
050 >>> MAIL From:<turibe@debian> SIZE=471
050 250 2.1.0 OK zb4si24120260obb.80 - gsmtp
050 >>> RCPT To:<>
050 >>> DATA
050 250 2.1.5 OK zb4si24120260obb.80 - gsmtp
050 354  Go ahead zb4si24120260obb.80 - gsmtp
050 >>> .
050 250 2.0.0 OK 1369900381 zb4si24120260obb.80 - gsmtp
050 <>... Sent (OK 1369900381 zb4si24120260obb.80 - gsmtp)
250 2.0.0 r4U7r1kG022811 Message accepted for delivery Sent (r4U7r1kG022811 Message accepted for delivery)
Closing connection to []
>>> QUIT
221 2.0.0 closing connection

I've tried several different addresses. It's driving me crazy. This seems like it should be a fairly simple issue to solve, but nothing I've tried nor anything I can find on the issue is working. I've read so many articles where the author says all he did to send mail was something like apt-get install sendmail and off he went, but none of the same steps are working for me.

Update Before this is asked, I did ensure that all outbound connections were enabled. And indeed, the mail command does appear to successfully connect with GMail.

Update This server is a Linode server, not a home server.

Update I followed this article exactly, and didn't run into any errors at all. Still, no luck sending emails. All I want from life is to be able to send email from my server.

Update I tried this article as well - no luck. /var/log/exim4/mainlog records after a few minutes that the message is frozen.

share|improve this question
Have you checked you "spam" box on your gmail account? – mdpc May 30 '13 at 21:16
Yes, I have. That was one of the first things I did. Sadly, there was nothing there either. – turibe May 30 '13 at 21:21
If you were to use a working MAIL FROM-address, it's likely you'd be getting a bounce to that address with just the information you need to figure the problem out. – Jenny D May 31 '13 at 8:19
@jennyd, Which one is being used? At the top of the output it says >>> MAIL From:<> SIZE=218, but further down it says 050 >>> MAIL From:<turibe@debian> SIZE=471 I just created the former email address and hope to receive the bounces there. I know it can take a while. If it's using the latter, do you know how to change that? I've tried changing the rewrite rules to no avail. – turibe May 31 '13 at 19:17

You should configure the server to use a smarthost as a relay. Normally, your ISP will provide a relay for you to use.

If you want to send directly to the Internet you need fixed IP address with a PTR record pointing to an A record which returns the address. Otherwise many servers will block you. You should also have an MX record for the domain you are sending from that points to your mail servers name. SPF record for both domains can help unless they forbid your server from sending for that domain.

Spamhaus lists many of the dynamic IP address ranges and you will get blocked if your IP address is listed there. If you are listed in other blacklists you are also likely to be blocked.

Just because your mail server has accepted the message for delivery, does not mean that your mail server will be able to deliver it. Try the mailq command to see if your server is still trying to send the message. Email is store and forward, and your server may take up to a day or so to tell you it is having problems delivering the mail.

EDIT: The easiest solution is to use the command dpkg-reconfigure exim4-config and select the smarthost option. Use your provider's email relay and things should work well. Make sure you use a valid sender email address. While GMail may work, it is extra effort to setup the required authentication, and they may limit the amount of email you send if your don't have a paid account.

If you want to run your own mail server you could start with my article on Running and Email Server. You may also want to review my Email Policy document and the documents it lists. I have several other posts related to email. My server of choice is Exim.

share|improve this answer
My server is on Linode. Perhaps I should have mentioned that, but I didn't realize anyone would think this was a home server. I've read soooo many articles on how to get sendmail working, and none of them have mentioned doing any DNS settings at all. There must be something else I'm missing. I ran mailq, and it reported that there were no queued messages. – turibe May 31 '13 at 7:15
I tried configuring exim4 to send through my Google Apps account as instructed in this article. Still no luck. Can you point me to any resources on configuring the DNS records as you've suggested? It still seems crazy to me that I never would have seen anything about making those changes, but I'm willing to try it. – turibe Jun 1 '13 at 22:17
I've added edits which may help get you on track. – BillThor Jun 7 '13 at 0:43
I ended up finally getting the emails working, and the issue was that I was using what apparently - contrary to the instructions of every article I read on the matter - the wrong address for the Gmail SMTP server. I do have a paid Google Apps account, so this is a good solution for me. – turibe Jun 8 '13 at 4:39
up vote 0 down vote accepted

I finally got the emails working by following this article:

The key difference appears to be this line in /etc/exim4/passwd.client: *

Once I added it, my emails started working. Previously, I had been using instead of * I tried removing that line in favor of the line to verify that that had been the fix, and indeed it was, as I could not send emails without the * line.

Since I do have a paid Google Apps account, using Google as the smarthost is a good solution for me.

share|improve this answer

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.