---- 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.
5 comments:
Great! In my case php.ini was located in /etc/php5/apache2/php.ini
Thanks a lot!
Great! In my case php.ini was located in /etc/php5/apache2/php.ini
Thanks a lot!
Hello thanks for this useful tutorial,it works.
But the email I received will put "nobody" as the sender name even I already add the "From:" in headers.
What can I do to change it?
Problem solved...I just noticed that I didn't change FromLineOverride=YES...
Still thanks to your tutorial,really help me a lot.
I have done same as per instruction...
but o/p is bool(false) ...
I am using LAMP in UBUNTU 12.04
any new idea please?
Post a Comment