Domain Emails for Free Using Google Apps
If you’ve ever wondered how to create email addresses using your own domain name, like [email protected] then there are many solutions through which you can achieve this. You can host your own email server by using postfix, citadel, zimbra or exim. But having your own email server means you are using some valuable resources in your server (CPU, memory and disk space) and also fighting against spams yourself and have to deal with different security concerns. Plus you’ll be missing your favorite Gmail interface which is far more advanced and user friendly then the freely available email suits. So wouldn’t it be great if you could have all the Gmail facility for your own domain specific email addresses? Yes Google Apps have a free edition where you can have upto 10 email user addresses named after your domain name instead of gmail.com. So you gonna have something like [email protected] addresses that will have all the facilities of gmail, including google’s advanced spam filter and gigabytes of disk space for free.
So let’s start with google apps for free. Sign up for Google Apps here. You can have a good step by step instruction on setting up google apps for email here. If you are using Linode, then the MX Records can be setup using the Linode DNS Manager, you don’t need the cpanel as described in this article. In-fact most VPS providers will have a DNS Manager where you can setup these MX Records.
After you’ve completed setting up everything according to the above link, you can now send and receive emails using your domain specific email addresses. Now only one thing you will be missing is to figure out how to send emails from your PHP applications. Because as there is no smtp server and the sendmail interface won’t work because you don’t have any email servers installed for sending the web application’s emails.
To resolve this problem you might want to install ssmtp, a very lightweight program which only runs when it’s needed to send emails. So you don’t have to worry about resource usage and also as this program will only send local emails using google servers, so there will be no security problems as long as your web application remain secured. So let’s install and configure ssmtp.
Now create an email address for the web applications in Google Apps (say [email protected]) and then configure that for using with ssmtp. To do that, let’s edit the ssmtp configuration file /etc/ssmtp/ssmtp.conf:
Press “i” to start editing the file, remove all the lines or comment them out and then use the following configuration:
root=[email protected] mailhub=smtp.gmail.com:587 hostname=hostname.example.com FromLineOverride=YES UseSTARTTLS=YES UseTLS=YES AuthUser=[email protected] AuthPass=YOUR_EMAIL_PASSWORD
Set the appropriate values for your hostname, email address and the password to access that email. Now save the file by pressing “ESC”, then type :x and then hit enter. Now you are done, you can check the email functionality by placing the following simple email script and accessing the php file in your browser.
$to = "[email protected]"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "[email protected]"; $headers = "From:" . $from; mail($to,$subject,$message,$headers); echo "Mail Sent.";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "[email protected]";
$headers = "From:" . $from;
echo "Mail Sent.";
Articles in this Step by Step VPS Setup Guide
Getting Started with VPS – The Beginners Tutorial
Introductory concepts on web servers and virtual private servers. Introducing you to the world wide web from a technical point of view.
Shared Hosting, VPS, Dedicated and Cloud Servers
Comparing the popular server hosting solutions. Basic understanding of shared, dedicated, vps and cloud servers.
Deploy a Linux VPS Server using Linode
Tutorial on deploying your linux distribution in your VPS server and setting up hostname and initial configurations
Setup NginX Web Server (Not Apache!) on Ubuntu 10.04
Analyzing why NginX web server is better for you instead of the mostly used Apache. Demonstration on how to setup and configure NginX on Ubuntu server.
Enable HTTPS (HTTP+SSL) in NginX Web Server
Tutorial on enabling secure http connections for NginX web server. Demonstrating how to self sign your SSL certificate for the VPS server.
NginX Password Protect Web Directory
Helping you to protect specific web directories with passwords for restricting access to administration section or important private files that need to be accessed through the web.
Setup PHP-FPM with APC on Ubuntu 10.04 for Faster Performance
Installing and Configuring PHP5 with Fast CGI Process Manager along with the excellent op-code cache solution APC for faster and optimized PHP backend.
Setup MySQL with PHPMyAdmin on Ubuntu 10.04
Setting up MySQL database server and configuring for better performance in low memory environment. Also setup a web based database management front-end named PHPMyAdmin.
Configure Domains and Subdomains in your VPS Running NginX
Tutorial on DNS setup for adding additional domains and subdomains. Also configuring NginX for handling each domains/subdomains.
Domain Emails for Free Using Google Apps
Setup domain specific email addresses without installing any email server in your VPS. Google Apps seems to be a better solution in this regard.