2

I currently have a web app set up to send email through webfaction, but I'm experiencing intermittent connection failures along the lines of:

Errno::ECONNREFUSED: Connection refused - connect(2)

I'd like to move to sending mail on the same server instead for the time being - what are the potential pit falls of switching email providers like this with a running app, and what measures should you take to make sure the emails make it through to their providers?

I'm aware there things to do like setting up backup mx records, setting spf records and so on, but I'm not sure how important each step is along the way.

I'm using Ubuntu 8.10 as my server OS, I'm using Workling to hive off email requests as separate processes.

C

5 Answers 5

3

A possible solution would be to switch from using webfaction to using the Google Mail SMTP servers to send your mail.

Since Google servers are reliable and free, you'll never have any problems.

Here's what to do:

  1. Install Google Apps on the domain.
  2. Set up SPF records, etc (read the docs).
  3. Now you can send mail freely through the Google SMTP mail servers.
  4. The mail will appear to originate from your domain (it will have the correct @mydomain.com). Of course, you could try to use the Google mail servers without installing Google Apps on your domain, but then Google would alter the "from" email address to be your gmail address.

This solution has been working well for me for a while. And as a bonus, you also get to use gmail to send company messages from your domain, without the unprofesional look of having a @gmail.com attached to the end of your email address.

1
  • cool solution, but what about bounces and logging? Do you get all the bounces and are you able to track what happened with your email? Jul 13, 2009 at 10:02
1

depending on how many emails are you sending and how important it is that they arrive, it might be wise to use a professional company

check out authsmp or for a different approach constantcontact

1
  • There's free solutions that are incredibly reliable (see answer below)
    – Contango
    Jul 9, 2009 at 17:42
1

You do not need to set backup MX records, that is for incoming mail only. SPF records are crucial as Sam has said, as is verifying that your ISP and firewalls won't block the traffic. You will also want to make sure that your ISP has a good reverse DNS entry (aka PTR) for the IP address that the emails will appear to originate from (critical difference between "appear to originate from" and "IP address of the server", depending on your firewall!), one that resolves to a hostname like "mail.your-domain.com". Without this, many, many domains will reject your emails, because most ISP give a default PTR record for you (like client-001-005.isp.com) and it looks like a bot-net'ed customer as far as DNS is concerned. Finally, verify that your IP address is not on any of the spam blacklists before you make the switch! In the past, I have been unpleasantly surprised to discover that the person/company who had my static IP address before me had gotten themselves on a lot of blacklists, so when I was given the IP with my new account, I couldn't send mail!

J.Ja

0

The first thing to do is check that the server your planning on sending mail out from is able to do so, make sure there are no problems with ISP's or firewalls blocking port 25 (I assume your using smtp).

If your server is only sending mail, not dealing with receiving it at all then setting up MX records is not really something that needs to be setup for this to work. That said, what is going to happen if somebody replies to one of these mails, do you want to receive them? If so then you may want to setup your MX records properly and setup to handle incoming mail.

SPF records are important, particularly when dealing with large mail providers like Hotmail and Gmail, who will often reject messages as spam without proper SPF. You also going to want to ensure that your have proper reverse DNS records setup, for the same reason. Your also going to make sure that your mail server greeting contains a valid hostname, with an A record setup for it.

0

If you want mail to go out in the background, use something that uses Sendmail in the background.

Sendmail is part of most Linux distributions. Its a binary that sends mail. The nice thing about it is that control returns instantly to the webpage, and Sendmail will queue everything up to send in its own time.

I wrote a shopping cart a while ago that sends an email once the shopping process is complete. I used phpmailer which in turn used Sendmail. Everything has been working perfectly since the day I switched to using Sendmail rather than a SMTP server.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .