- Tham gia
- 05/07/2016
- Bài viết
- 4,225
Learn how to install Ubuntu Server here.
Read the following tutorial on how to install apache2 on Ubuntu server.
Read this tutorial if you want to learn how to install PHP5.
Now you’ve installed and configured everything, it’s time to start the installation process.
First run the following command to install ‘ssmtp’. Ssmtp is a lightweight package, which uses the SMTP protocol to send emails out. SMTP is a widely used protocol, almost all email clients and providers support it. In this tutorial I’m using a Gmail account, you can use another email address or providers as well.
Next, we’ll be editing a configuration file, which will point to the Gmail account. Run the following command:
Add the following lines to the configuration file. Don’t forget to enter your own email address and password. And if you don’t use Gmail, enter the proper SMTP hostname as well.
Now it’s time to change the php.ini file that’s used with apache.
Find the “sendmail_path” line and set it like this:
The -t option we’ve added basically tells ssmtp to read the “To”, “Cc” and “Bcc” headers and extract the recipients from there.
Close the php.ini file by pressing ctrl + x, Y and Enter.
Now it’s time to restart apache, and you can start sending out email with PHP!
Read the following tutorial on how to install apache2 on Ubuntu server.
Read this tutorial if you want to learn how to install PHP5.
Now you’ve installed and configured everything, it’s time to start the installation process.
First run the following command to install ‘ssmtp’. Ssmtp is a lightweight package, which uses the SMTP protocol to send emails out. SMTP is a widely used protocol, almost all email clients and providers support it. In this tutorial I’m using a Gmail account, you can use another email address or providers as well.
| 1 | sudo apt-get install ssmtp |
| 1 | sudo nano /etc/ssmtp/ssmtp.conf |
| 1 2 3 4 | mailhub=smtp.gmail.com:587 UseSTARTTLS=YES AuthUser=[email protected] AuthPass=yourpassword |
| 1 | sudo nano /etc/php5/apache2/php.ini |
| 1 | sendmail_path = /usr/sbin/sendmail -t |
Close the php.ini file by pressing ctrl + x, Y and Enter.
Now it’s time to restart apache, and you can start sending out email with PHP!

