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
Return to the default flat view Create a new topic Submit Reply
Re: sending email [message #174876 is a reply to message #174874] Fri, 15 July 2011 06:32 Go to previous message
alvaro.NOSPAMTHANX is currently offline  alvaro.NOSPAMTHANX
Messages: 277
Registered: September 2010
Karma:
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
--
[Message index]
 
Read Message
Read Message
Read Message
Read Message
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:31:39 GMT 2024

Total time taken to generate the page: 0.04783 seconds