FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » sending email
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
sending email [message #174874] Fri, 15 July 2011 04:33 Go to next message
cerr is currently offline  cerr
Messages: 33
Registered: September 2010
Karma: 0
Member
Hi There,

I wrote following test script:
<?php
$to = "myself(at)gmail(dot)com";
$subject = "Test";
$body = "This is a test!";
if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!<br><FORM><INPUT TYPE=\"button\" VALUE=\"Back\" onClick=\"history.go(-1);return true;\"></FORM></p>");
} else {
echo("<p>Message delivery failed...</p>");
}
?>
and i get Message successfully sent! but no email ever arrives in my inbox, why not? What am i dong wrong?

Thank you!
Ron
Re: sending email [message #174875 is a reply to message #174874] Fri, 15 July 2011 05:06 Go to previous messageGo to next message
Geoff Muldoon is currently offline  Geoff Muldoon
Messages: 19
Registered: July 2011
Karma: 0
Junior Member
ron(dot)eggler(at)gmail(dot)com says...
>
> Hi There,
>
> I wrote following test script:
> <?php
> $to = "myself(at)gmail(dot)com";
> $subject = "Test";
> $body = "This is a test!";
> if (mail($to, $subject, $body)) {
> echo("<p>Message successfully sent!<br><FORM><INPUT TYPE=\"button\" VALUE=\"Back\" onClick=\"history.go(-1);return true;\"></FORM></p>");
> } else {
> echo("<p>Message delivery failed...</p>");
> }
> ?>
> and i get Message successfully sent! but no email ever arrives in my inbox, why not? What am i dong wrong?

Look in your server's sendmail/smtp logs, most smtp servers these days
might spam-bot out your message after it has successfully passed through
the PHP stage without some additional well-formed headers like "from:"
(you have this set in your php.ini?)

GM
Re: sending email [message #174876 is a reply to message #174874] Fri, 15 July 2011 06:32 Go to previous messageGo to next message
alvaro.NOSPAMTHANX is currently offline  alvaro.NOSPAMTHANX
Messages: 277
Registered: September 2010
Karma: 0
Senior Member
El 15/07/2011 6:33, cerr escribió/wrote:
> I wrote following test script:
> <?php
> $to = "myself(at)gmail(dot)com";
> $subject = "Test";
> $body = "This is a test!";
> if (mail($to, $subject, $body)) {
> echo("<p>Message successfully sent!<br><FORM><INPUT TYPE=\"button\" VALUE=\"Back\" onClick=\"history.go(-1);return true;\"></FORM></p>");
> } else {
> echo("<p>Message delivery failed...</p>");
> }
> ?>
> and i get Message successfully sent! but no email ever arrives in my inbox, why not? What am i dong wrong?

PHP (or any other programming language for what it matters) has no way
to know whether an e-mail message was successfully delivered or not.
When mail() returns TRUE it basically means that it was able to contact
the mail server and hand it the message. After that, there are many
additional steps.

In your case, you are omitting at least two important pieces of information:

- You don't set a "From:" header (the address displayed by the e-mail
client).

- You don't set an envelop address (the address where failure
notifications will be sent).

The first one can be set with mail()'s fourth parameter,
$additional_headers:

'From: John Doe <john(at)example(dot)com'

The second one can be set with the fifth parameter, $additional_parameters:

'-fjohn(at)example(dot)com'

The envelope address is not optional so your server is probably filling
it with some bogus info. That (and the lack of "From") is likely to make
spam filters reject your message.


--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
Re: sending email [message #174877 is a reply to message #174875] Fri, 15 July 2011 13:48 Go to previous message
cerr is currently offline  cerr
Messages: 33
Registered: September 2010
Karma: 0
Member
> Look in your server's sendmail/smtp logs, most smtp servers these days
> might spam-bot out your message after it has successfully passed through
> the PHP stage without some additional well-formed headers like "from:"
> (you have this set in your php.ini?)

Yep, the missing "from:" part was the problem, exactly!
Thank you!

Ron
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Restricting access to a website
Next Topic: Stats comp.lang.php (last 7 days)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 03:27:46 GMT 2024

Total time taken to generate the page: 0.35627 seconds