Email is hard.

At least SENDING emails from websites is.

Don’t feel bad if you’ve had trouble ‘getting it right’. You’re not alone. Many companies have made fantastically successful businesses out of making it easier and/or more reliable (mailchimp, etc). However, you may not have the volume of emails that would justify paying for a 3rd party service to deliver your emails. Perhaps you’re just sending signup confirmations or receipts for your small website.

You can easily send emails in almost any web programming language in a single line of code – what’s so hard about it? The hard part is actually getting those emails delivered to your recipients! 🙂

I’ve had to address this issue with some of my clients for one of my products that allow the customer to configure their email settings – ie the FROM email address and the option use of an SMTP server to send the emails. I wound up writing a primer on email services to help them understand their options and why they mattered. That primer is now part of that product’s documentation, but I thought it might be useful to others who might stumble across it here.

Email Settings

What email to use as the FROM address is entirely a marketing decision, but it has technical implications (spam blocking).

The thing that is confusing is the idea that an email FROM [email protected]om does not NEED to be sent from and official email server @somedomain.com. ANY computer can send an email from [email protected], directly TO [email protected] The email does not need to pass through the email server of the ‘from’ email address at all (unless the person writing the email chooses to do so). The core function of email servers is to RECEIVE emails. Sending emails through official email servers is optional. This is the root of the email spam problem. Email is not secure in any way.

However most email SERVICES (such as hotmail, gmail) will block or flag emails coming TO their customers, if the ip address of the machine sending the email doesn’t match the official email server of the domain of the sender (@somedomain.com) (this is the case if the web server itself is used to send the email without using smtp). How hotmail or gmail actually flag or block the email in that case depends on whether the computer that sent the email is listed on one of several ‘blacklists’ of computers that are known to send spam. If the computer that sent the email is on the blacklist, the recipient won’t even see the email. If the computer that sent the email is not on a blacklist, they may get the email, but it will most likely be flagged as possible spam. Many shared hosting web servers are included in those blacklists.

Using an SMTP server to send an email with matching FROM address avoids this blocking and flagging by being more trustworthy to the large email service providers.

Another flavor of the problem is that even if you do use an smtp server, you may still be able to send emails using a different FROM address than the smtp server’s domain name. Some smtp servers will not allow this, but some will. There is nothing in the email specifications that says that the email FROM address needs to match the account of the user on the email server. So if you use a different FROM address than the smtp email account used to send the email two problems may arise: 1) the smtp server may not send the email. If it does, then 2) email services such as hotmail, gmail, may still flag or block the email as spam.

An additional complication is that some web hosting companies will not allow websites to SEND emails (via smtp or directly), unless they pass through their own email proxy servers. They do this to limit the amount of spam emails being sent by hacked websites (this is a good thing, although it complicates life for the rest of us). GoDaddy is one such service. You need to configure your email settings to match the GoDaddy documentation.