A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

Jump to

Quick reference

Set up sendmail on linux desktop

Setting up email sending (not receiving) for XAMPP in Ubuntu.

Install Postfix:
  • sudo apt-get install postfix
  • Choose satellite system
  • Choose example.com for the system mail name (it will mean the 'hidden' Return-Path address goes to nothing, not the visible From/Reply-to address)
  • Type your ISP's SMTP address
  • Type a user for incoming email
  • Just accept the defaults for other questions
If you need to reconfigure, do sudo dpkg-reconfigure postfix

To check the version, do postconf -d | grep mail_version

PHP/XAMPP settings:
  • In php.ini, add: sendmail_path = /usr/sbin/sendmail -t
Test like this:



$email = 'you@yourdomain.com';
$headers = "From: $email\r\n";
$headers .= "Reply-To: $email\r\n";
$subject = "test subject";
$message = "test body";
print mail($email,$subject,$message,$headers) . "\n";

?>