Monday, September 20, 2010

Configure LAMP on Ubuntu 10.04 to send email via PHP mail function

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.

Saturday, September 18, 2010

Colorfull gnome terminal

Most popular distro Ubuntu in current version 10.04 comes with gnome terminal as default. But colors have gone. Gnome terminal uses colors for ls listing. But to less.
Edit your .bashrc

"gedit ~/.bashrc"

Allow force_color_prompt=yes, probably just remove opening #
"force_color_prompt=yes"

I altered the color schema as well. I like white on black background.
"Edit -> Profile settings -> Colors" - choose your desired built-in scheme or make your own