Setting up the PHP Mail Function on a Ubuntu 10.10 LAMP Server

In this video I configure a LAMP server running on Ubuntu to allow for the PHP mail() function to work. To follow along with this video you must already have the LAMP server installed in the operating system. I use the following commands:
apt-get install php-pear
pear install mail
pear install Net_SMTP
pear install Auth_SASL
pear install mail_mime
apt-get install postfix
For more information visit

17 thoughts on “Setting up the PHP Mail Function on a Ubuntu 10.10 LAMP Server

  1. I can not use apachectl graceful, it will show error like below:
    apache2: Could not reliably determine the server's fully qualified domain name,
    using for ServerName

    Can I use sudo service apache2 restart instead.

    Thank you for this clear video.

  2. @lecturesnippets well dear, whn i asked the netwrk admin here , he said tested the log messages using "tail" command and identified that the ip z in spam list and hence the mail couldnt be sent 🙁 !

  3. @frontierdragon Hey I have to say thanks for this comment, I tested my server and got the same results as you. There must have been some change in one of the updates, anyhow I got it working again by going to /etc/php5/apache2/php.ini and setting the sendmail path for Unix to "/usr/sbin/sendmail -t -i". I hope that works for you too.

  4. i followed the same steps and all went on well… even i have set
    $sentmail= mail($to,$subject,$message,$headers);
    echo "mail sent";

    and receive the message "mail sent" but the mail is not received at my yahoo id…Thanks for this video BUT HELP me plzzzzz !!!

Leave a Reply

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