I'm a web developer, recently I switched my main system from Windows to Debian.

However, I faced only one problem. Emails.

While installing Debian, Exim was installed automatically.

My machine is not accessible from Internet, I'm using local address and virtualhost for multiple websites. My ISP provides dynamic IPs - changed dynamically every connection or every 24 hours.

Now's my question to ServerFaulters. Is it possible to configure Exim to send emails? Right now, I'm developing a website that requires email activation, that sends some notifications and I'd like to test them.

Update Here comes line from mail.log:

Sep  5 15:50:13 dev sm-mta[19400]: o85CpQTt017758: to=<account>@gmail.com, delay=00:58:05, xdelay=00:31:31, mailer=esmtp, pri=210021, relay=alt4.gmail-smtp-in.l.google.com. [], dsn=4.0.0, stat=Deferred: Connection timed out with alt4.gmail-smtp-in.l.google.com.

Where is my email account name.

Any suggestions?

Regards, Tom


Well, yes and no.

Yes, exim can easily be configured to send emails. However, your problem will most likely be the fact that you are on a dynamic IP address. In fact, your ISP probably wouldn't like you to use your home machine as a mail server. A lot of mail servers around the world will treat yours as suspicious if you cannot provide working reverse DNS (this is where an IP address must resolve to a host/service name, which (for email purposes) should match one of the MX records in the DNS). And if you are on a dynamic IP, you need to use some sort of dynamic DNS setup to keep this up to date. This can easily become a nightmare, especially if one of your sites gets busy.

I would recommend looking for a mail service provider. Once you have found one that you like (and can afford, as they will probably charge you separately for each domain), they will provide a facility for SMTP mail forwarding. You can then configure your local exim MTA to use a smarthost (the mail server from the ISP) and forward all messages to the smarthost. That solves all the above problems.

If all you're after is local sending and receiving, then all you really need to do is make sure that you have a local user account and then configure your sites to send to that local account. The mailbox for that account will be located in the user's home folder and you can either use the mail command to see what's in it, or you can configure a local mail client to use that mailbox (Thunderbird should do the trick).
You will need to configure your local domain properly for this to work. In terms of exim setup, the best option is probably to run dpkg-reconfigure exim4.

  • Wolfgang, thanks for your response. The main issue is that I want send emails only to my external account - only to test them - using PHP mail() function or SwiftMailer. This is the point. Also I need to check is notifications are sent correctly using Cron job. I do not need any reqular mail server, there would be only few mails an hour. Sending / receiving emails locally works perfectly but I'm not able to send external emails. I've alreadu run dpkg-reconfigure exim4 and changed config to Internet. I can find any error in exim/system logs. Any suggestions? – Tom Sep 5 '10 at 13:50
  • Wolfgang, found something weird in my opinion in mail.log, I altered my question. – Tom Sep 5 '10 at 13:52
  • I would recommend to do this differently. For starters, don't use the php <code>mail()</code> function. Rather install PEAR and use their mailer, it is far more flexible and it can send straight to your gmail account, if you provide the correct details (IP address, credentials, etc.). You can also this from within a cron job (just run a PHP script from the cron). – wolfgangsz Sep 5 '10 at 14:00

You may want to keep all your emails local to your development setup initially. I just posted an answer which may be useful, although you may need more information to help you with the exim configuration.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy