Skip to the main content.
Contact us
Contact us
1 min read

How to fix PHP mail function on Ubuntu server?

 

There are a lot of packages out there that will help you get going with PHP mail on Ubuntu. I´m going to tell you about one of the easiest ways to do it, with the minimal amount of lines.

 

Send emails from PHP with ssmtp

The installation process:

sudo apt-get install ssmtp

 

Then edit the /etc/ssmtp/ssmtp.conf file with this information:

mailhub=smtp.gmail.com:587
UseSTARTTLS=YES
AuthUser=<YOUR-EMAIL>@gmail.com
AuthPass=<YOUR-PASSWORD>

(or any other SMTP-server that you might want to use)

 

Final steps:
Find your php.ini file (usually in /etc/php5/cli/php.ini) and make sure the sendmail_path is:

sendmail_path = /usr/sbin/sendmail -t

 

Then restart your apache2-server with

service apache2 restart

 

Now you can send outgoing emails with PHP!

12 min read

American brands guide success in Sweden

American brand entering Swedish market

I have been a fortune to see, follow and experience some great brands entering...

5 min read

Lead nurturing by persuasion

Lead Nurturing – Persuasion strategy Framework

Lead Nurturing campaigns by Semantiko. A lead Nurturing...

7 min read

Facebook algoritm update

Facebook requires more to reach out. “The media world is shaking”.

Facebook’s algorithm not only benefits the...