Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #2559 > unrolled thread

sending email

Started bycerr <ron.eggler@gmail.com>
First post2011-07-14 21:33 -0700
Last post2011-07-15 08:32 +0200
Articles 3 — 3 participants

Back to article view | Back to comp.lang.php


Contents

  sending email cerr <ron.eggler@gmail.com> - 2011-07-14 21:33 -0700
    Re: sending email Geoff Muldoon <geoff.muldoon@trap.gmail.com> - 2011-07-15 15:06 +1000
    Re: sending email "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2011-07-15 08:32 +0200

#2559 — sending email

Fromcerr <ron.eggler@gmail.com>
Date2011-07-14 21:33 -0700
Subjectsending email
Message-ID<fa536de2-d437-45c1-809e-a50cf60eaa12@glegroupsg2000goo.googlegroups.com>
Hi There,

I wrote following test script:
<?php
 $to = "myself@gmail.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

[toc] | [next] | [standalone]


#2560

FromGeoff Muldoon <geoff.muldoon@trap.gmail.com>
Date2011-07-15 15:06 +1000
Message-ID<MPG.288a75cd332d351d9896a9@news.x-privat.org>
In reply to#2559
ron.eggler@gmail.com says...
> 
> Hi There,
> 
> I wrote following test script:
> <?php
>  $to = "myself@gmail.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

[toc] | [prev] | [next] | [standalone]


#2561

From"Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid>
Date2011-07-15 08:32 +0200
Message-ID<ivomuv$4mn$1@dont-email.me>
In reply to#2559
El 15/07/2011 6:33, cerr escribió/wrote:
> I wrote following test script:
> <?php
>   $to = "myself@gmail.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@example.com'

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

	'-fjohn@example.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
--

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web