---- OLD ----
Lampp comes like standalone package without need to reconfigure something. It runs out of box. But If your Ubuntu installation has no configured mail server, it is problem to send mails via PHP mail function. Here is quick solution how use Gmail SMTP server to send emails from localhost:
sudo apt-get install ssmtp
sudo gedit /etc/ssmtp/ssmtp.confedit variables hostname, FromLineOverride
hostname=smtp.gmail.com
FromLineOverride=YES
sudo gedit /opt/lampp/etc/php.iniadd or change following variables in php.ini
smtp_port = 465
sendmail_path =/usr/sbin/ssmtp -t
Restart lampp
sudo /opt/lampp/lampp restart
create php mail testing script like:
$additional_headers = 'From: michaeljackson@heaven.org' . "\r\n";$res = mail('recipient@domain.com','test','test body', $additional_headers);var_dump($res);?>
$res should be TRUE after executing and check out your mail mailbox, there should be something like this:
Thanks to this forum post.