I know very little about PHP but need to move a PHP site temporarily to Webfaction before rewriting it to Django.
I tried to rewrite the below PHP file to use PEAR but I get no error message and don't receive any email.
<?php
require_once "Mail.php";
if(!empty($HTTP_POST_VARS['sender_mail']))
{
$from_addr = "existing.address@webfaction-address.com";
$to = "my@email.com";
$subject = "Test";
$body = stripslashes($HTTP_POST_VARS['sender_name'])."\n".stripslashes($HTTP_POST_VARS['sender_email'])."\n".stripslashes($HTTP_POST_VARS['sender_phone'])."\n".stripslashes($HTTP_POST_VARS['sender_postal'])."\n".stripslashes($HTTP_POST_VARS['sender_code'])."\n".stripslashes($HTTP_POST_VARS['sender_city'])."\n".stripslashes($HTTP_POST_VARS['sender_country']);
$body .= "\n\n---------------------------\n";
$body .= "Mail sent by: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_mail'] . ">\n";
$headers = array ("From" => $from_addr,
"To" => $to,
"Subject" => $subject
"Reply-To => "Reply-To: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_mail'] . ">");
$smtp = Mail::factory("smtp", array ('host' => "smtp.webfaction.com",
'auth' => true,
'username' => "xxxxxxxxxxx",
'password' => "xxxxxxxxxxx"));
$mail = $smtp->send($to, $headers, $body);
if ( PEAR::isError($mail) ) {
echo $mail->getMessage();
}
else {
echo "output=sent";
}
} else {
echo "output=error&info=no-email";
}
?>
Result is always output=sent but email is never received. I am using a Static/ CGI/ PHP app. Do I need to install the PEAR mail package? Does not seem like it as require_once "Mail.php"; does not give any error message.
Any easy way to debug?
asked
25 Nov '10, 07:03
lamusoftware
197●1●8●17
accept rate:
16%
PEAR is definitely installed (as you noticed,
require_once
doesn't fail). Could you give us the to/from addresses? We'll check our mail logs and see if anything turns up.If you'd rather not give that information out here, you can open a support ticket.