Another way to get sendmail command maybe?
Posted: Thu Jun 21, 2007 1:22 pm
I tried to get the sendmail class to auto detect the command in PHP 4 and it kept failing to do so. So I found a this to work:
I had to add the -i removal because it would cause swift to crash. I don't know what the -i does. Of course some hosts have sendmail on their box but it's not configured. So this is not a full proof way of doing it.
I did run into the fact that sendmail stop() was also getting called twice for some reason. This in turn cased the foreach to fail. To combat that I had to put it inside an is_array if statement.
Code: Select all
$sendmail_path = @ini_get('sendmail_path'); //Find the sendmail_path in the ini
$sendmail_path = str_replace(' -i', '', $sendmail_path); //If there is a -i get rid of it
if (function_exists('proc_open') && !empty($sendmail_path)) { //If the proc_open function exists and we have something in the sendmail path
$swift =& new Swift(new Swift_Connection_Sendmail($sendmail_path)); //Try it
}I did run into the fact that sendmail stop() was also getting called twice for some reason. This in turn cased the foreach to fail. To combat that I had to put it inside an is_array if statement.