RE: [PHP] Mail Function Problem
| From: | Alice Wei | Date: | Mon, 12 Apr 2010 23:46:39 +0000 |
| Subject: | RE: [PHP] Mail Function Problem | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-304018@lists.php.net to get a copy of this message | ||
> Date: Mon, 12 Apr 2010 15:54:05 -0500
> From: kdk@daleco.biz
> To: kranthi117@gmail.com
> CC: ajwei@alumni.iu.edu; php-general@lists.php.net
> Subject: Re: [PHP] Mail Function Problem
>
> kranthi wrote:
> > PEAR's mail package does support authentication.
> >
> > http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm
> >
>
> I will say "mea culpa" on this one; apparently I didn't
> dig deep enough into the PEAR docs to figure this out.
> It's certainly not mentioned on the manpage at php.net,
> but, of course, the PEAR stuff is elsewhere. I read over
> the first page linked from the PHP manpage, so it must
> have been a lil' deeper than that. If it's only available
> at about.com (lol), I'd suggest filing a PR with the PEAR
> folk's documentation team, eh?
>
> But, this time I'll do what I shoulda mentioned before and
> include the "IANAE" disclaimer on all things PEAR, many
> things PHP, and some things SMTP.
>
> Kevin Kinsey
I tried installing the Pear Mail package, it is now located in php/PEAR/Mail, and my code is located
in the htdocs. 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'];
if($_POST['submit']=="Submit") {
$from = "elite.english@att.net";
$to = $email;
$subject = "Comments Regarding HH Web Design Studio";
$body = "From: $your_name\n E-Mail: $email\n Reason Contact: $question\n Comments:\n
$comments";
$host = "smtp.att.yahoo.com";
$username = "my_user_name";
$password = "password";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$mail->send($to, $headers, $body);
if (PEAR::isError($mail)) echo "<p>" . $mail->getMessage() .
"</p>";
This is what I get:
Fatal error: Class 'Mail' not found in C:\xampp\htdocs\Alice.Wei\web\mail.php
on line 30
Do I need to move the Mail PEAR class to the same folder as my web folder? How can I make sure that
my Pear is running?
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