Send E-mail with Localhost on Ubuntu with PHP. The Ubuntu Operating Environment is good for web developers. so mainly you require sometime to send email from localhost. Also you might be necessary to check the email features from localhost development time.
Here I have a small tutorial, Which will help you to send email from localhost. you can configure it very well.
Just follow the steps.
- Install ssmtp through terminal
sudo apt-get install ssmtp
2. You have to configure your gmail here to use. So you have to edit the configuration file. You can edit it by accessing the direct path or you can go with shell mode.
3. Here I used my gmail credentials in the:
gksu gedit /etc/ssmtp/ssmtp.conf
Just edit it.
# Config file for sSMTP sendmail # # The person who gets all mail for userids < 1000 # Make this empty to disable rewriting. #root=postmaster email@example.com # The place where the mail goes. The actual machine name is required no # MX records are consulted. Commonly mailhosts are named mail.domain.com #mailhub=mail mailhub=smtp.gmail.com:587 AuthUserfirstname.lastname@example.org AuthPass=**** UseTLS=YES UseSTARTTLS=YES # Where will the mail seem to come from? #rewriteDomain= rewriteDomain=gmail.com # The full hostname #hostname=MyMediaServer.home email@example.com # Are users allowed to set their own From: address? # YES - Allow the user to specify their own From: address # NO - Use the system generated From: address FromLineOverride=YES
That’s it. It will help you to send mail from your Ubuntu localhost by accessing your gmail.
Note : ** https://www.google.com/settings/security/lesssecureapps if you are using Gmail, you must turn on less secure for the signin of localhost and send email using the gmail smtp.