Prev: Does PHP support multi-thread ?
Next: Class constants
From: Alice Wei on 18 Apr 2010 11:11 Hi, After several days, I have rebuilt my system on Linux using Ubuntu, installed PEAR and such. Thankfully, when I execute the code, it no longer gives me the error that the class is not found. Yet, when I submit the form now, I can always see the confirmation message telling me that my message has been sent, but I cannot see it even in another mailbox. Here is the code: require_once("Mail.php"); $mail = Mail::factory("mail"); $your_name = $_POST['your_name']; $email = $_POST['email']; $question = $_POST['question']; $comments= $_POST['comments']; $submit = $_POST['submit']; $from = "localhost"; $to = $email; $subject = "Comments"; $body = "From: $your_name\n E-Mail: $email\n Reason Contact: $question\n Comments:\n $comments"; $host = "localhost"; $headers = array ('From' => $from,'To' => $to,'Subject' => $subject); $mail ->send($to, $headers, $body); if (PEAR::isError($mail)) echo "<p>" . $mail->getMessage() . "</p>"; else { echo "<p>Message successfully sent!</p> <div id='main'> <h1>Thank You For Contacting Us</h1> <p>We will contact you within the next <b>24 business hours</b>.</p> <p>Here is what you have input:</p> <ul><li>Your Name is <b>" . $your_name . "</b></li> <li>Your Email is <b>" . $email . "</b></li> <li>You contacted us because you have a <b>" . $question . "</b></li> <li>Here are your comments: <b>" . $comments . "</b></li></ul> <h1>Have a Nice Day!</h1></div>"; } } Can anyone on the list please give me some pointers on what might have been wrong here? I have not edited anything in the php.ini file regarding SMTP. Thanks. Alice _________________________________________________________________ The New Busy is not the old busy. Search, chat and e-mail from your inbox.. http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3
From: Karl DeSaulniers on 18 Apr 2010 16:33 Hey Alice, Again, try throwing the MIME in. $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; Karl On Apr 18, 2010, at 10:11 AM, Alice Wei wrote: > > Hi, > > After several days, I have rebuilt my system on Linux using > Ubuntu, installed PEAR and such. Thankfully, when I execute the > code, it no longer gives me the error that the class is not found. > Yet, when I submit the form now, I can always see the confirmation > message telling me that my message has been sent, but I cannot see > it even in another mailbox. > > Here is the code: > > require_once("Mail.php"); > $mail = Mail::factory("mail"); > > $your_name = $_POST['your_name']; > $email = $_POST['email']; > $question = $_POST['question']; > $comments= $_POST['comments']; > $submit = $_POST['submit']; > > $from = "localhost"; > $to = $email; > $subject = "Comments"; > $body = "From: $your_name\n E-Mail: $email\n Reason Contact: > $question\n Comments:\n $comments"; > > $host = "localhost"; > $headers = array ('From' => $from,'To' => $to,'Subject' => $subject); > $mail ->send($to, $headers, $body); > if (PEAR::isError($mail)) echo "<p>" . $mail->getMessage() . "</p>"; > else { > echo "<p>Message successfully sent!</p> <div id='main'> > <h1>Thank You For Contacting Us</h1> > <p>We will contact you within the next <b>24 business hours</ > b>.</p> > <p>Here is what you have input:</p> > <ul><li>Your Name is <b>" . $your_name . "</b></li> > <li>Your Email is <b>" . $email . "</b></li> > <li>You contacted us because you have a <b>" . > $question . "</b></li> > <li>Here are your comments: <b>" . $comments . "</b></ > li></ul> > <h1>Have a Nice Day!</h1></div>"; > } > } > > Can anyone on the list please give me some pointers on what might > have been wrong here? I have not edited anything in the php.ini > file regarding SMTP. > > Thanks. > > Alice > > > > > _________________________________________________________________ > The New Busy is not the old busy. Search, chat and e-mail from your > inbox. > http://www.windowslive.com/campaign/thenewbusy? > ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3 Karl DeSaulniers Design Drumm http://designdrumm.com
From: Kevin Kinsey on 18 Apr 2010 22:02 Karl DeSaulniers wrote: > Hey Alice, > Again, try throwing the MIME in. > > $headers = 'MIME-Version: 1.0' . "\r\n"; > $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; Also: $headers .= 'Errors-to: <myworkingemailaddress(a)foo.com>' . "\r\n"; Which I suggested on your previous thread. Also, I see you have $from set to equal "localhost". Many SMTP servers will reject this I *think*, because "localhost" is a hostname, not a working mailbox. Try making $from equal to a real working address - possibly the same one as your "Errors-to:" header.. My $0.02, KDK > > On Apr 18, 2010, at 10:11 AM, Alice Wei wrote: > >> >> Hi, >> >> After several days, I have rebuilt my system on Linux using Ubuntu, >> installed PEAR and such. Thankfully, when I execute the code, it no >> longer gives me the error that the class is not found. Yet, when I >> submit the form now, I can always see the confirmation message telling >> me that my message has been sent, but I cannot see it even in another >> mailbox. >> >> Here is the code: >> >> require_once("Mail.php"); >> $mail = Mail::factory("mail"); >> >> $your_name = $_POST['your_name']; >> $email = $_POST['email']; >> $question = $_POST['question']; >> $comments= $_POST['comments']; >> $submit = $_POST['submit']; >> >> $from = "localhost"; >> $to = $email; >> $subject = "Comments"; >> $body = "From: $your_name\n E-Mail: $email\n Reason Contact: >> $question\n Comments:\n $comments"; >> >> $host = "localhost"; >> $headers = array ('From' => $from,'To' => $to,'Subject' => $subject); >> $mail ->send($to, $headers, $body); >> if (PEAR::isError($mail)) echo "<p>" . $mail->getMessage() . "</p>"; >> else { >> echo "<p>Message successfully sent!</p> <div id='main'> >> <h1>Thank You For Contacting Us</h1> >> <p>We will contact you within the next <b>24 business >> hours</b>.</p> >> <p>Here is what you have input:</p> >> <ul><li>Your Name is <b>" . $your_name . "</b></li> >> <li>Your Email is <b>" . $email . "</b></li> >> <li>You contacted us because you have a <b>" . $question . >> "</b></li> >> <li>Here are your comments: <b>" . $comments . "</b></li></ul> >> <h1>Have a Nice Day!</h1></div>"; >> } >> } >> >> Can anyone on the list please give me some pointers on what might have >> been wrong here? I have not edited anything in the php.ini file >> regarding SMTP. >> >> Thanks. >> >> Alice
From: Alice Wei on 18 Apr 2010 22:27 > Date: Sun, 18 Apr 2010 21:02:29 -0500 > From: kdk(a)daleco.biz > To: ajwei(a)alumni.iu.edu > CC: karl(a)designdrumm.com; php-general(a)lists.php.net > Subject: Re: [PHP] Mail Function Using PEAR Issues > > Karl DeSaulniers wrote: > > Hey Alice, > > Again, try throwing the MIME in. > > > > $headers = 'MIME-Version: 1.0' . "\r\n"; > > $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; > > Also: > > $headers .= 'Errors-to: <myworkingemailaddress(a)foo.com>' . "\r\n"; > > Which I suggested on your previous thread. Also, I see you have > $from set to equal "localhost". Many SMTP servers will reject this > I *think*, because "localhost" is a hostname, not a working mailbox. > Try making $from equal to a real working address - possibly the same > one as your "Errors-to:" header.. > > My $0.02, > > KDK > > > > > On Apr 18, 2010, at 10:11 AM, Alice Wei wrote: > > > >> > >> Hi, > >> > >> After several days, I have rebuilt my system on Linux using Ubuntu, > >> installed PEAR and such. Thankfully, when I execute the code, it no > >> longer gives me the error that the class is not found. Yet, when I > >> submit the form now, I can always see the confirmation message telling > >> me that my message has been sent, but I cannot see it even in another > >> mailbox. > >> > >> Here is the code: > >> > >> require_once("Mail.php"); > >> $mail = Mail::factory("mail"); > >> > >> $your_name = $_POST['your_name']; > >> $email = $_POST['email']; > >> $question = $_POST['question']; > >> $comments= $_POST['comments']; > >> $submit = $_POST['submit']; > >> > >> $from = "localhost"; > >> $to = $email; > >> $subject = "Comments"; > >> $body = "From: $your_name\n E-Mail: $email\n Reason Contact: > >> $question\n Comments:\n $comments"; > >> > >> $host = "localhost"; > >> $headers = array ('From' => $from,'To' => $to,'Subject' => $subject); > >> $mail ->send($to, $headers, $body); > >> if (PEAR::isError($mail)) echo "<p>" . $mail->getMessage() . "</p>"; > >> else { > >> echo "<p>Message successfully sent!</p> <div id='main'> > >> <h1>Thank You For Contacting Us</h1> > >> <p>We will contact you within the next <b>24 business > >> hours</b>.</p> > >> <p>Here is what you have input:</p> > >> <ul><li>Your Name is <b>" . $your_name . "</b></li> > >> <li>Your Email is <b>" . $email . "</b></li> > >> <li>You contacted us because you have a <b>" . $question . > >> "</b></li> > >> <li>Here are your comments: <b>" . $comments . "</b></li></ul> > >> <h1>Have a Nice Day!</h1></div>"; > >> } > >> } > >> > >> Can anyone on the list please give me some pointers on what might have > >> been wrong here? I have not edited anything in the php.ini file > >> regarding SMTP. > >> > >> Thanks. > >> > >> Alice > Hi, Here is the revised version, and I don't think I have experienced any changes in terms of the output on the screen. Plus, I still get no email. <?php require_once("Mail.php"); $mail = Mail::factory("mail"); $your_name = $_POST['your_name']; $email = $_POST['email']; $question = $_POST['question']; $comments= $_POST['comments']; $submit = $_POST['submit']; $from = "ajwei(a)alumni.iu.edu"; $to = "elite.english(a)gmail.com"; $subject = "Comments"; $body = "From: $your_name\n E-Mail: $email\n Reason Contact: $question\n Comments:\n $comments"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; $headers .= 'Errors-to: <elite.english(a)gmail.com>' . "\r\n"; $mail ->send($to, $headers, $body); if (PEAR::isError($mail)) echo "<p>" . $mail->getMessage() . "</p>"; else { echo "<p>Message successfully sent!</p> <div id='main'> <h1>Thank You For Contacting Us</h1> <p>Here is what you have input:</p> <ul><li>Your Name is <b>" . $your_name . "</b></li> <li>Your Email is <b>" . $email . "</b></li> <li>You contacted us because you have a <b>" . $question . "</b></li> <li>Here are your comments: <b>" . $comments . "</b></li></ul> <h1>Have a Nice Day!</h1></div>"; } I have made sure that my $from and $to addresses are different, Could there be anything else wrong here? I have not edited anything in php.ini regarding this issue. Would I need to? Thanks for your help. Alice _________________________________________________________________ The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail. http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4
From: Karl DeSaulniers on 18 Apr 2010 22:33
Is there any need for this line if you are using the Errors-to: ? Maybe take it out and see what Errors-to gives you without it. On Apr 18, 2010, at 9:27 PM, Alice Wei wrote: > > if (PEAR::isError($mail)) echo "<p>" . $mail->getMessage() . > OAN - That sendmail script I posted, I know works on Linux servers if you want to compare notes with it. Best, Karl DeSaulniers Design Drumm http://designdrumm.com |