I am using ubuntu on my virtual machine. I would like to send emails using catchmail as described here: http://berk.es/2011/05/29/mailcatcher-for-drupal-and-other-php-applications-the-simple-version/
I am trying to send emails like that:
//Mailer class:
class Mailer extends PHPMailer
{
public $UTF8Encode = false;
public function __construct($param = null)
{
parent::__construct($param);
$this->Mailer = 'sendmail';
$this->Sendmail = 'smtp://localhost:1025';
$this->From = 'xxxx@xxxx.com';
$this->FromName = 'Support';
$this->WordWrap = 50;
$this->CharSet = 'UTF-8';
}
}
....etc....
And:
//Sending emails
$mail = new Mailer();
$mail->Body = "xxxx";
$mail->Subject = "xxx";
$mail->From = 'xxxx@xxxx.org';
$mail->FromName = 'Support';
$mail->WordWrap = 50;
$mail->AddAddress(xxxx@xxxx.com);
And I am getting the error:
Could not execute: smtp://localhost:1025
The problem with this is you’re telling PHPMailer to use a command line program called
sendmailinstead of using smtp. And PHPMailer tries to do something like:And as you can tell this won’t work.
To tell PHPMailer to use smtp you need to do the following:
If your SMTP server needs Authentification you can do that as follows: