edited 2010-11-08 former guide doesn't work for me more (changed to ubuntu 10.10 64b lampp 1.7.3a) but this helped me
http://tombuntu.com/index.php/2008/10/21/sending-email-from-your-system-with-ssmtp/
---- 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.conf
edit variables hostname, FromLineOverride
hostname=smtp.gmail.com
FromLineOverride=YES
sudo gedit /opt/lampp/etc/php.ini
add 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.