From: Kevin Kinsey on
Alice Wei wrote:
>
>> 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?

Well, it's a Good Thing(tm) to know what those settings are.
Have they changed since your last thread?

KDK

From: Peter Lind on
Most, if not all, mail servers keep log files. You should look for the
log files to see if the mail server has sent your mail properly or is
experiencing problems (those may not feed back into PHP).

Regards
Peter

--
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
</hype>
From: Alice Wei on

> Date: Sun, 18 Apr 2010 21:39:19 -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
>
> Alice Wei wrote:
> >
> >> 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?
>
> Well, it's a Good Thing(tm) to know what those settings are.
> Have they changed since your last thread?
>

I have not changed any of my SMTP settings since my new installation of
PHP with Pear. So, I am not sure what the settings are supposed to be.
Would I need to install anything else even when the Pear Mail package
has been installed?

Alice

_________________________________________________________________
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5
From: David McGlone on
On Mon, 2010-04-19 at 08:25 -0400, Alice Wei wrote:

> I have not changed any of my SMTP settings since my new installation of
> PHP with Pear. So, I am not sure what the settings are supposed to be.
> Would I need to install anything else even when the Pear Mail package
> has been installed?

Alice, I never use the PEAR install from my distro, I always download
and install PEAR into my working folder. The benefit of doing it this
way is so that when you move your project to a different server, nothing
will break and you don't have to change anything.

Sometimes when I create a new project, I'll just copy the PEAR folder
from an older project to the new one. The only thing you may have to
change in your PHP code is the path to the PEAR libs only if you don't
put them in the same place every time.

Blessings,
David M.

From: Ken Guest on
On Tue, Apr 20, 2010 at 2:10 AM, David McGlone <david(a)dmcentral.net> wrote:
> On Mon, 2010-04-19 at 08:25 -0400, Alice Wei wrote:
>
>> I have not changed any of my SMTP settings since my new installation of
>> PHP with Pear. So, I am not sure what the settings are supposed to be.
>> Would I need to install anything else even when the Pear Mail package
>> has been installed?

You might, depending on if you need to use the Mail_Mime or Mail_Queue
packages also (for sending emails with attachments etc etc or for
sending mails in bulk).
Also there's some rather nice new functionality in the more recent
versions of Mail and Net_SMTP that enable you to log the ESMTP Id of
mails you have submitted to a mail server (along with the SMTP
greeting sent by that server when you connect to it).

> Alice, I never use the PEAR install from my distro, I always download
> and install PEAR into my working folder. The benefit of doing it this
> way is so that when you move your project to a different server, nothing
> will break and you don't have to change anything.
>
> Sometimes when I create a new project, I'll just copy the PEAR folder
> from an older project to the new one. The only thing you may have to
> change in your PHP code is the path to the PEAR libs only if you don't
> put them in the same place every time.
>

When some bug is fixed or dependencies of some of those PEAR packages
change I think you'll find your attitude towards that will change -
there's a pear installer so you don't have to update and track the
dependencies by hand - you do regularly update your packages don't
you? It's smart to do so because at the very least you don't have to
implement work-arounds for bugs that have been fixed in later versions
of those packages - and in the worst-case scenario it means you're not
using versions that have PEAR Security Advisories issued against them.

I believe it's possible to have seperate pear config files per project
so you're not limited to having to use the same versions of packages
across all projects.

If you're using more than a handful of PEAR packages in your project
you might want to write your own meta-package for the project; that
way you don't have to install all those packages individually;
you just do something like "$pear install myProject.xml" and the pear
installer will download and install whichever pear packages you have
described in your xml file.

Details on doing this are at
http://pear.php.net/manual/en/guide.users.dependencytracking.php

For the record, this is the example script that I submitted to
http://www.web-development-blog.com/archives/php-mail-scripts-using-smtp-transport-a-guide-for-beginners/
for demonstrating how to use the PEAR packages for sending a mail with
a file attached.:

<?php
require_once "Mail.php";
require_once "Mail/mime.php";

$from = "Fred Flintstone <flinty(a)example.com>“;
$to = “Barney Rubble <barneyr(a)example.net>“;
$subject = “Mail Subject”;
$message = “this is the text of the mail, sent using PEAR’s Mail packages.”;
$host = “smtp.example.com”;
$port = “25″;
$headers = array (‘From’ => $from, ‘To’ => $to, ‘Subject’ => $subject);
$smtp = Mail::factory(’smtp’, array (‘host’ => $host, ‘port’ => $port));
$mime = new Mail_mime();
$mime->setTxtBody($message);
$mime->addAttachment(“/home/ken/logo.png”, ‘image/png’);
$body = $mime->get();
$mail = $smtp->send($to, $mime->headers($headers), $body);

if (PEAR::isError($mail)) {
echo($mail->getMessage() . “!\n”);
} else {
echo(“Message successfully sent to $to!\n”);
echo “Queued As (ESMTP Id): “, $smtp->queued_as, “\n”;
echo “Greeting From Mailserver: “, $smtp->greeting, “\n”;
}

?>


> Blessings,
> David M.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



--
http://blogs.linux.ie/kenguest/
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5
Prev: Does PHP support multi-thread ?
Next: Class constants