To use smtp to send mail with php tutorial

Help with issues regarding installation of Debian

To use smtp to send mail with php tutorial

Postby popscript » 2009-11-29 22:14

How To use comcast smtp to send mail with php

After spending 3 days trying to get my Ubuntu server to send mail using PHP scripts on my server I finally got it working and wanted to post here how it was done. Hopefully I can save others out there how to get this done without spending so much time.

First off this tutorial is for comcast customers trying to get there ubuntu server to send mail out on their servers using PHP scripts.
Comcast has officially blocked port 25 many years ago so we will use their alt port 587

This specific tutorial is for those that run apache under xampp for linux.

First install ssmtp;

Open terminal and type;

apt-get install ssmtp

Or if you are not logged in as root
sudo apt-get install ssmtp

Next, configure ssmtp with login info for comcast:

SSMTP Config file:

Your ssmpt.conf file should look like this:

First open the ssmtp.conf file by using the terminal command below.

gedit /etc/ssmtp/ssmtp.conf

# Config file for sSMTP sendmail
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.

# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named or

# Where will the mail seem to come from?

# The full 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

Change php.ini file for apache: (Applies if you have installed xampp for linux)
Your Apache server will not know where to look for the ssmtp server unless you show it where the path is located at to send mail in your php.ini file.


find line:
sendmail_path = /usr/sbin/ssmtp -t
NOTE: The -t is required by Apache in order to allow PHP to send mail.

This tells apache how to send mail using php scripts on your ubuntu server.

The most important: restart apache

/opt/lampp/lampp restart

If would like, you can test email by opening terminal and use this command;
echo "This is a test message. Ubuntu rocks!" | mailx -s 'Testing This Email SMTP Server'

The End:
You should now be able to send mail from your PHP scripts on your ubuntu apache server without having to specify the login for comcast for each and every script hosted on your server.

1) If you put an email address into the line; root= the server will send mail however it will show it coming from your actual comcast email address. This might not be good for the other professional domains that you maybe hosting on your ubuntu server. If you allow override as posted above and leave the root= empty then the email will appear to come from the domain it was sent from.
2) Due to the fact that ssmtp uses login you may also be able to use gmail to send mail through their smtp servers however this was not tested in this tutorial although it should work as well.
Posts: 1
Joined: 2009-11-29 22:11

Return to Installation

Who is online

Users browsing this forum: No registered users and 6 guests