470,855 Members | 1,158 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,855 developers. It's quick & easy.

php email problem

I have tried the following code:

FileName: index2.php
---------------------------------

<?
mail( "aa*@yahoo.com", "A", "B", "From: a...@aol.com" );
echo "Finished Emailing.";
?>

For some reason I don't get an email in my aa*@yahoo.com account, but
the message "Finished Emailing" does display. Seems pretty
simple...but it doesn't work. Can someone help me figure out what is
wrong...or the best way to debug this? thanks...

Dec 21 '05 #1
4 1365
nu***********@gmail.com wrote:
I have tried the following code:

FileName: index2.php
---------------------------------

<?
mail( "aa*@yahoo.com", "A", "B", "From: a...@aol.com" );
echo "Finished Emailing.";
?>

For some reason I don't get an email in my aa*@yahoo.com account, but
the message "Finished Emailing" does display. Seems pretty
simple...but it doesn't work. Can someone help me figure out what is
wrong...or the best way to debug this? thanks...

The way you've set the test up, the 'finished emailing' message will
always show up, so it's no real test at all.

Try this instead and look at the result

if( mail( "aa*@yahoo.com", "A", "B", "From: a...@aol.com" ) ) {
echo 'Finished Emailing.';
}
else {
echo 'Sending mail failed';
}

If the message got send, try checking your Yahoo spam box - the message
might be filtered to it.

If the message sending failed, look at the error messages or warnings.
If none display, put the following line above the test:

error_reporting( E_ALL );

For more info, start reading: http://www.php.net/manual/en/function.mail.php
Dec 21 '05 #2
nu***********@gmail.com wrote:
<snip>
For some reason I don't get an email in my aa*@yahoo.com account, but
the message "Finished Emailing" does display. Seems pretty
simple...but it doesn't work. Can someone help me figure out what is
wrong...or the best way to debug this? thanks...


IIRC, there is a bug in PHP and it's yet to be fixed. If the mail
server is too sensitive, it won't accept stating "syntax error" or so.
Yahoo! server seems to be so sensitive; try gmail instead.

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Dec 21 '05 #3
Thanks guys...alas, nothing seems to work. I've tried the following
code:

<?
error_reporting( E_ALL );

if( mail( "nu***********@gmail.com", "A", "B", "From: ab*@aol.com" ) )
{
echo 'php - Finished Emailing.';
}
else {
echo 'php - Sending mail failed';
}
?>

And I still don't get an email. Not sure what to think...is there any
other "mail" option I have for my HTML / PHP bases Web Site?

Dec 21 '05 #4
nu***********@gmail.com wrote:
Thanks guys...alas, nothing seems to work. I've tried the following
code:

<?
error_reporting( E_ALL );

if( mail( "nu***********@gmail.com", "A", "B", "From: ab*@aol.com" ) )
{
echo 'php - Finished Emailing.';
}
else {
echo 'php - Sending mail failed';
}
?>

And I still don't get an email. Not sure what to think...is there any
other "mail" option I have for my HTML / PHP bases Web Site?


You could have a look at this fully featured open source class:
http://phpmailer.sourceforge.net/

They may have figured out ways to get round the bug mentioned by Rajesh.
Dec 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by jpastora | last post: by
6 posts views Thread by mike | last post: by
88 posts views Thread by Mike | last post: by
26 posts views Thread by libsfan01 | last post: by
3 posts views Thread by IGD | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.