login community faq

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.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?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 Nov 25 '10 at 07:03

lamusoftware's gravatar image

lamusoftware
1679

1

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.

(Nov 25 '10 at 07:07) David L ♦♦ David%20L's gravatar image
Be the first one to answer this question!
If you have an answer to the above question, then use the form below. Otherwise, use the appropriate 'add new comment' button above to post your feedback.
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

×150
×49
×6

Asked: Nov 25 '10 at 07:03

Seen: 923 times

Last updated: Nov 25 '10 at 07:07

Plans & prices    Sign up    Why WebFaction?    Contact us    Affiliate program    Support    Legal    Jobs    Blog    Control panel login
Powered by OSQA
© Copyright 2003-2012 Swarma Limited - WebFaction is a service of Swarma Limited