Send Mail from PHP Using SMTP Authentication

Send Mail from PHP Using SMTP Authentication

am 12.04.2010 22:06:21 von Alice Wei

--_5fb9aa0e-847c-4cfa-9b6d-8858bedbc664_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


Hi,

Just as I am exploring some of my alternatives for using the mail() in PH=
P=2C I came across a web page that one of the users on the list has provide=
d me: http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_ SMTP_Auth=
entication.htm. Does anyone know what the Mail.php is referring to here?=20


require_once "Mail.php"=3B

$from =3D "Sandra Sender "=3B

$to =3D "Ramona Recipient "=3B

$subject =3D "Hi!"=3B

$body =3D "Hi=2C\n\nHow are you?"=3B

?>

If it is something from PEAR package=2C why isn't it necessary for it to sp=
ecify the path to that code?=20
Can it tell by itself?

Thanks for your help.

Alice

=20
____________________________________________________________ _____
Hotmail is redefining busy with tools for the New Busy. Get more from your =
inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=3DPID283 26::T:WLMTAGL:O=
N:WL:en-US:WM_HMP:042010_2=

--_5fb9aa0e-847c-4cfa-9b6d-8858bedbc664_--

Re: Send Mail from PHP Using SMTP Authentication

am 12.04.2010 22:13:10 von Ferenc Kovacs

--0015174c3e8425a39304840fc681
Content-Type: text/plain; charset=UTF-8

http://www.php.net/manual/en/ini.core.php#ini.include-path

Tyrael

On Mon, Apr 12, 2010 at 10:06 PM, Alice Wei wrote:

>
> Hi,
>
> Just as I am exploring some of my alternatives for using the mail() in
> PHP, I came across a web page that one of the users on the list has provided
> me:
> http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_ SMTP_Authentication.htm.
> Does anyone know what the Mail.php is referring to here?
>
> >
> require_once "Mail.php";
>
> $from = "Sandra Sender ";
>
> $to = "Ramona Recipient ";
>
> $subject = "Hi!";
>
> $body = "Hi,\n\nHow are you?";
>
> ?>
>
> If it is something from PEAR package, why isn't it necessary for it to
> specify the path to that code?
> Can it tell by itself?
>
> Thanks for your help.
>
> Alice
>
>
> ____________________________________________________________ _____
> Hotmail is redefining busy with tools for the New Busy. Get more from your
> inbox.
>
> http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326 ::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2

--0015174c3e8425a39304840fc681--

Re: Send Mail from PHP Using SMTP Authentication

am 12.04.2010 22:13:26 von Niel Archer

>
> Hi,
>
> Just as I am exploring some of my alternatives for using the mail() in PHP, I came across a web page that one of the users on the list has provided me: http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_ SMTP_Authentication.htm. Does anyone know what the Mail.php is referring to here?
>
> >
> require_once "Mail.php";
>
> $from = "Sandra Sender ";
>
> $to = "Ramona Recipient ";
>
> $subject = "Hi!";
>
> $body = "Hi,\n\nHow are you?";
>
> ?>
>
> If it is something from PEAR package, why isn't it necessary for it to specify the path to that code?
> Can it tell by itself?

Because if PEAR is setup correctly, then its directory is in the include
path and this file will be found there.

> Thanks for your help.
>
> Alice
>
>
> ____________________________________________________________ _____
> Hotmail is redefining busy with tools for the New Busy. Get more from your inbox.
> http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326 ::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2

--
Niel Archer



--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: Send Mail from PHP Using SMTP Authentication

am 13.04.2010 14:24:14 von Alice Wei

--_56b535dc-add0-46c9-89d3-b98babab85a0_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


Date: Mon=2C 12 Apr 2010 22:13:10 +0200
Subject: Re: [PHP-WIN] Send Mail from PHP Using SMTP Authentication
From: tyra3l@gmail.com
To: ajwei@alumni.iu.edu
CC: php-windows@lists.php.net

http://www.php.net/manual/en/ini.core.php#ini.include-path

Tyrael

I tried installing the Pear Mail package=2C it is now located in=20
php/PEAR/Mail=2C and my code is located in the htdocs. Here is the code:

require_once("Mail.php")=3B
$mail
=3D Mail::factory("mail")=3B

$your_name =3D $_POST['your_name']=3B
$email
=3D $_POST['email']=3B
$question =3D $_POST['question']=3B
$comments=
$_POST['comments']=3B
$submit =3D $_POST['submit']=3B

if($_POST['submit']=="Submit")
{
$from =3D "elite.english@att.net"=3B
$to =3D $email=3B
$subject =
"Comments Regarding HH Web Design Studio"=3B
$body =3D "From:=20
$your_name\n E-Mail: $email\n Reason Contact: $question\n Comments:\n=20
$comments"=3B

$host =3D "smtp.att.yahoo.com"=3B
$username =
"my_user_name"=3B
$password =3D "password"=3B
$headers =3D array ('From'=20
=3D> $from=2C
'To' =3D> $to=2C
'Subject' =3D> $subject)=3B
$mail->send($to=2C
$headers=2C $body)=3B

if (PEAR::isError($mail)) echo "

" .=20
$mail->getMessage() . "

"=3B

This is what I get:=20

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=20
same folder as my web folder? How can I make sure that my Pear is=20
running?
Thanks for your help.

Alice

On Mon=2C Apr 12=2C 2010 at 10:06 PM=2C Alice Wei wro=
te:



Hi=2C



Just as I am exploring some of my alternatives for using the mail() in PH=
P=2C I came across a web page that one of the users on the list has provide=
d me: http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_ SMTP_Auth=
entication.htm. Does anyone know what the Mail.php is referring to here?







require_once "Mail.php"=3B



$from =3D "Sandra Sender "=3B



$to =3D "Ramona Recipient "=3B



$subject =3D "Hi!"=3B



$body =3D "Hi=2C\n\nHow are you?"=3B



?>



If it is something from PEAR package=2C why isn't it necessary for it to sp=
ecify the path to that code?

Can it tell by itself?



Thanks for your help.



Alice





____________________________________________________________ _____

Hotmail is redefining busy with tools for the New Busy. Get more from your =
inbox.

http://www.windowslive.com/campaign/thenewbusy?ocid=3DPID283 26::T:WLMTAGL:O=
N:WL:en-US:WM_HMP:042010_2

=20
____________________________________________________________ _____
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with H=
otmail.=20
http://www.windowslive.com/campaign/thenewbusy?tile=3Dmultic alendar&ocid=3D=
PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5=

--_56b535dc-add0-46c9-89d3-b98babab85a0_--

Re: Send Mail from PHP Using SMTP Authentication

am 13.04.2010 15:42:29 von Ferenc Kovacs

--00032555a97ec77c6d04841e6ee6
Content-Type: text/plain; charset=UTF-8

On Tue, Apr 13, 2010 at 2:24 PM, Alice Wei wrote:

>
> Date: Mon, 12 Apr 2010 22:13:10 +0200
> Subject: Re: [PHP-WIN] Send Mail from PHP Using SMTP Authentication
> From: tyra3l@gmail.com
> To: ajwei@alumni.iu.edu
> CC: php-windows@lists.php.net
>
> http://www.php.net/manual/en/ini.core.php#ini.include-path
>
> Tyrael
>
> 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 "

" .
> $mail->getMessage() . "

";
>
> 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.
>
>
http://www.php.net/manual/en/ini.core.php#ini.include-path
set the PEAR path to your include_path in your php.ini
....
gosh

Tyrael

--00032555a97ec77c6d04841e6ee6--

RE: Send Mail from PHP Using SMTP Authentication

am 13.04.2010 15:54:35 von Alice Wei

--_1150b716-2022-4a89-9ba7-4473cdcf34ad_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable



Date: Tue=2C 13 Apr 2010 15:42:29 +0200
Subject: Re: [PHP-WIN] Send Mail from PHP Using SMTP Authentication
From: tyra3l@gmail.com
To: ajwei@alumni.iu.edu
CC: php-windows@lists.php.net



On Tue=2C Apr 13=2C 2010 at 2:24 PM=2C Alice Wei wrot=
e:



Date: Mon=2C 12 Apr 2010 22:13:10 +0200

Subject: Re: [PHP-WIN] Send Mail from PHP Using SMTP Authentication

From: tyra3l@gmail.com

To: ajwei@alumni.iu.edu

CC: php-windows@lists.php.net



http://www.php.net/manual/en/ini.core.php#ini.include-path



Tyrael



I tried installing the Pear Mail package=2C it is now located in

php/PEAR/Mail=2C and my code is located in the htdocs. Here is the code:



require_once("Mail.php")=3B

$mail

=3D Mail::factory("mail")=3B



$your_name =3D $_POST['your_name']=3B

$email

=3D $_POST['email']=3B

$question =3D $_POST['question']=3B

$comments=3D

$_POST['comments']=3B

$submit =3D $_POST['submit']=3B



if($_POST['submit']=="Submit")

{

$from =3D "elite.english@att.net"=3B

$to =3D $email=3B

$subject =3D

"Comments Regarding HH Web Design Studio"=3B

$body =3D "From:

$your_name\n E-Mail: $email\n Reason Contact: $question\n Comments:\n

$comments"=3B



$host =3D "smtp.att.yahoo.com"=3B

$username =3D

"my_user_name"=3B

$password =3D "password"=3B

$headers =3D array ('From'

=3D> $from=2C

'To' =3D> $to=2C

'Subject' =3D> $subject)=3B

$mail->send($to=2C

$headers=2C $body)=3B



if (PEAR::isError($mail)) echo "

" .

$mail->getMessage() . "

"=3B



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.



http://www.php.net/manual/en/ini.core.php#ini.include-path
set the PEAR path to your include_path in your php.ini

I did have that. I have include_path =3D ".=3BC:\xampp\php\PEAR=3B". Do I h=
ave to physically type in pear install Mail to install the Mail package her=
e?


Thanks.

Alice

=20
____________________________________________________________ _____
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with H=
otmail.=20
http://www.windowslive.com/campaign/thenewbusy?tile=3Dmultic alendar&ocid=3D=
PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5=

--_1150b716-2022-4a89-9ba7-4473cdcf34ad_--

Re: Send Mail from PHP Using SMTP Authentication

am 13.04.2010 16:05:31 von Ferenc Kovacs

--00032555a97e2e3a2f04841ec1d5
Content-Type: text/plain; charset=UTF-8

On Tue, Apr 13, 2010 at 3:54 PM, Alice Wei wrote:

>
> ------------------------------
> Date: Tue, 13 Apr 2010 15:42:29 +0200
>
> Subject: Re: [PHP-WIN] Send Mail from PHP Using SMTP Authentication
> From: tyra3l@gmail.com
> To: ajwei@alumni.iu.edu
> CC: php-windows@lists.php.net
>
>
>
> On Tue, Apr 13, 2010 at 2:24 PM, Alice Wei wrote:
>
>
> Date: Mon, 12 Apr 2010 22:13:10 +0200
> Subject: Re: [PHP-WIN] Send Mail from PHP Using SMTP Authentication
> From: tyra3l@gmail.com
> To: ajwei@alumni.iu.edu
> CC: php-windows@lists.php.net
>
> http://www.php.net/manual/en/ini.core.php#ini.include-path
>
> Tyrael
>
> 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 "

" .
> $mail->getMessage() . "

";
>
> 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.
>
>
> http://www.php.net/manual/en/ini.core.php#ini.include-path
> set the PEAR path to your include_path in your php.ini
>
> I did have that. I have *include_path = ".;C:\xampp\php\PEAR;"*. Do I have
> to physically type in pear install Mail to install the Mail package here?
>
>
As far as I remember, the xampp is by default contains the Mail package, but
you should check the presence of the Mail.php in the C:\xampp\php\PEAR
directory.
the include_path seems good but the last ; is not necessary.
Could you check that you removed the ; from the begining of the line, and
that you don't have any other active include_path line in your php.ini, and
you modified the correct php.ini?
last time when I checked xampp, the php.ini was in xampp/apache/bin

Tyrael

> Thanks.
>
> Alice
>
>
> ------------------------------
> The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with
> Hotmail. Get busy.
>

--00032555a97e2e3a2f04841ec1d5--

Re: Send Mail from PHP Using SMTP Authentication

am 13.04.2010 16:15:48 von Toby Hart Dyke

On 4/13/2010 2:54 PM, Alice Wei wrote:
> 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:
>
> $host = "smtp.att.yahoo.com";
>
Although you have other problems (see below) this is unlikely to work.
When sending email, you need to either authenticate yourself with the
server, or use an SMTP server in your local domain (which *may* accept
all mail without authentication). This will be a mail server run by your
ISP.

Given your email address domain (iu.edu) you should probably try
mail.iu.edu or smtp.iu.edu, or just ask your local administrator where
you should be sending email, and if you need to authenticate.

All that said, you define $host, but don't seem to use it anywhere. I've
never used the Pear Mail package, so can't tell you where that should go.
> Fatal error: Class 'Mail' not found in C:\xampp\htdocs\Alice.Wei\web\mail.php
> >set the PEAR path to your include_path in your php.ini
>
> I did have that. I have include_path = ".;C:\xampp\php\PEAR;". Do I have to physically type in pear install Mail to install the Mail package here?
>
Did you restart the web server after changing that? Changes to the
server php.ini won't get picked up until a restart.

Toby


--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: Send Mail from PHP Using SMTP Authentication

am 13.04.2010 16:17:24 von Alice Wei

--_e6de733b-658d-410e-a9b8-e71990bbbaa2_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable




Date: Tue=2C 13 Apr 2010 16:05:31 +0200
Subject: Re: [PHP-WIN] Send Mail from PHP Using SMTP Authentication
From: tyra3l@gmail.com
To: ajwei@alumni.iu.edu
CC: php-windows@lists.php.net



On Tue=2C Apr 13=2C 2010 at 3:54 PM=2C Alice Wei wrot=
e:







Date: Tue=2C 13 Apr 2010 15:42:29 +0200
Subject: Re: [PHP-WIN] Send Mail from PHP Using SMTP Authentication
From: tyra3l@gmail.com

To: ajwei@alumni.iu.edu
CC: php-windows@lists.php.net




On Tue=2C Apr 13=2C 2010 at 2:24 PM=2C Alice Wei wrot=
e:



Date: Mon=2C 12 Apr 2010 22:13:10 +0200

Subject: Re: [PHP-WIN] Send Mail from PHP Using SMTP Authentication

From: tyra3l@gmail.com

To: ajwei@alumni.iu.edu

CC: php-windows@lists.php.net



http://www.php.net/manual/en/ini.core.php#ini.include-path



Tyrael



I tried installing the Pear Mail package=2C it is now located in

php/PEAR/Mail=2C and my code is located in the htdocs. Here is the code:



require_once("Mail.php")=3B

$mail

=3D Mail::factory("mail")=3B



$your_name =3D $_POST['your_name']=3B

$email

=3D $_POST['email']=3B

$question =3D $_POST['question']=3B

$comments=3D

$_POST['comments']=3B

$submit =3D $_POST['submit']=3B



if($_POST['submit']=="Submit")

{

$from =3D "elite.english@att.net"=3B

$to =3D $email=3B

$subject =3D

"Comments Regarding HH Web Design Studio"=3B

$body =3D "From:

$your_name\n E-Mail: $email\n Reason Contact: $question\n Comments:\n

$comments"=3B



$host =3D "smtp.att.yahoo.com"=3B

$username =3D

"my_user_name"=3B

$password =3D "password"=3B

$headers =3D array ('From'

=3D> $from=2C

'To' =3D> $to=2C

'Subject' =3D> $subject)=3B

$mail->send($to=2C

$headers=2C $body)=3B



if (PEAR::isError($mail)) echo "

" .

$mail->getMessage() . "

"=3B



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.



http://www.php.net/manual/en/ini.core.php#ini.include-path

set the PEAR path to your include_path in your php.ini

I did have that. I have include_path =3D ".=3BC:\xampp\php\PEAR=3B". Do I h=
ave to physically type in pear install Mail to install the Mail package her=
e?



As far as I remember=2C the xampp is by default contains the Mail package=
=2C but you should check the presence of the Mail.php in the C:\xampp\php\P=
EAR directory.
the include_path seems good but the last =3B is not necessary.

Could you check that you removed the =3B from the begining of the line=2C a=
nd that you don't have any other active include_path line in your php.ini=
=2C and you modified the correct php.ini?
last time when I checked xampp=2C the php.ini was in xampp/apache/bin

Interesting=2C l just checked my phpinfo() page=2C and the Loaded configura=
tion file is claimed to be located at C:\xampp\php\php.ini=2C and the confi=
gure command=2C it reads cscript/nologo configure.js "--enable-snashot-buil=
d". The PHP_PEAR_SYSCONF_DIR is C:\xampp\php=2C When I use cmd to run the c=
ommand=2C I type C:\xampp\php>pear and the output returns blank.

Looks like I don't have PEAR installed. If these are included properly=2C h=
ow can I install it?

Thanks.

Alice
=20
____________________________________________________________ _____
The New Busy is not the too busy. Combine all your e-mail accounts with Hot=
mail.
http://www.windowslive.com/campaign/thenewbusy?tile=3Dmultia ccount&ocid=3DP=
ID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4=

--_e6de733b-658d-410e-a9b8-e71990bbbaa2_--