Correct way to send email from a webserver

Hey Sitepoint,

What are the steps I need to take to ensure that emails sent from my webserver will arrive in a users inbox? Is there a check list I can through ex, headers, proper email address, clean IP address, from address, to address, reply-to address, message body under a certain size, message body lacking spammy words etc?

Also make sure you authenticate your mails with a domain key (DKIM). More info here:
The biggest no no is using a different domain in the ‘from’ address then the server from which the email is sent. It will instantly be marked as spam.

On the other hand, use Google mail server to handle your emails, and use SwiftMailer for sending emails from PHP. It’s the best tool you can find.

Thank you. I’m not too familiar with Google mail server or SwiftMailer I will look into them immediately. Would you be able to elaborate on what kind of headers are required to send a properly formed email?

If you use SwiftMailer it will handle it for you.

Chaching! Thank you.

  1. Set up a mailbox account on your server that you will use to send the emails from.

  2. Use Swiftmailer or PHPMailer package - configure it to send emails via SMTP of your mailbox account.

Awesome I’ve got it working now :smiley: Thanks for your help guys.