Send E-mail From Localhost on Ubuntu with PHP - Kvcodes
X

Congrats, You are Subscribed to Receive Updates.

Send E-mail From Localhost on Ubuntu with PHP


Introduction

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.

send-mail-from-localhost-ubuntu

Steps

Just follow the steps.

  1. 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
root=****@gmail.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

AuthUser=****@gmail.com
AuthPass=****
UseTLS=YES
UseSTARTTLS=YES

# Where will the mail seem to come from?
#rewriteDomain=
rewriteDomain=gmail.com

# The full hostname
#hostname=MyMediaServer.home
hostname=kvcodes  # Here you have to use your system hostname

# 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.

** You have to change the hostname with your localhost name, you can get it with the below command. hostname on your terminal, you will get your host name and use it there, which I have pointed in green.

commenter

About Varadharaj V

The founder of Kvcodes, Varadharaj V is an ERP Analyst and a Web developer specializing in WordPress(WP), WP Theme development, WP Plugin development, Frontaccounting(FA), Sales, Purchases, Inventory, Ledgers, Payroll & HRM, CRM, FA Core Customization, OpenCart Theme Development, PHP, HTML, CSS, jQuery, Bootstrap development and content SEO.

Comment Below

Your email address will not be published. Required fields are marked *

*

Current ye@r *

Menu

Sidebar

Subscribe E-mail Updates

Congrats, You are Subscribed to Receive Updates.

Advertisement

Category Posts