Hi,
I ran into trouble with the latest version of
PostNuke after upgrading
PHP; the mailer wouldn't work. I suspect that the chrooted environment was the trouble. Whatever I tried I could not get the mail() function to work.
I found the solution at
http://php.mybsd.org…ual/en/ref.mail.php and modified it a bit for
PostNuke. Essesntially, the function opens a socket and talks smtp directly. I included the function in pnAPI and edited the pnMail function to call my function instead. The function is:
<?php function socketmail
($username,
$useremail,
$fromname,
$from,
$subject,
$message) { $connect =
fsockopen (ini_get("SMTP"),
ini_get("smtp_port"),
$errno,
$errstr,
30) or
die("Could not talk to the sendmail server!");
$rcv =
fgets($connect,
1024);
fputs($connect,
"HELO {$_SERVER['SERVER_NAME']}\r\n");
$rcv =
fgets($connect,
1024);
fputs($connect,
"MAIL FROM:$from\r\n");
$rcv =
fgets($connect,
1024);
fputs($connect,
"RCPT TO:$useremail\r\n");
$rcv =
fgets($connect,
1024);
fputs($connect,
"DATA\r\n");
$rcv =
fgets($connect,
1024);
fputs($connect,
"Subject: $subject\r\n");
fputs($connect,
"From: $fromname <$from>\r\n");
fputs($connect,
"To: $username <$useremail>\r\n");
fputs($connect,
"X-Sender: <$from>\r\n");
fputs($connect,
"Return-Path: <$from>\r\n");
fputs($connect,
"Errors-To: <$from>\r\n");
fputs($connect,
"X-Mailer: PHP\r\n");
fputs($connect,
"X-Priority: 3\r\n");
fputs($connect,
"Content-Type: text/plain; charset=iso-8859-1\r\n");
fputs($connect,
"\r\n");
fputs($connect,
stripslashes($message).
" \r\n");
fputs($connect,
".\r\n");
$rcv =
fgets($connect,
1024);
fputs($connect,
"RSET\r\n");
$rcv =
fgets($connect,
1024);
fputs ($connect,
"QUIT\r\n");
$rcv =
fgets ($connect,
1024);
fclose($connect);
} ?>
Hope this helps.
Guido