php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14981 mail() function won't send mail to a domain containing '-' hyphens
Submitted: 2002-01-10 17:59 UTC Modified: 2002-01-11 08:55 UTC
From: andrew at digitalhands dot co dot uk Assigned:
Status: Not a bug Package: Mail related
PHP Version: 4.1.0 OS: Unix
Private report: No CVE-ID: None
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
48 + 47 = ?
Subscribe to this entry?

 
 [2002-01-10 17:59 UTC] andrew at digitalhands dot co dot uk
The following example script:

 $r = "info@the-total-solution.com";
 $s = "Message submitted at website";
 $m = "From: " . $name . ", email: " . $email . "\n\n" . $message;
 $h = "From: " . $email . "\r\n";
 mail ($r, $s, $m, $h);
 echo "<script language=\"javascript\">window.alert (\"Thankyou, your
message have been sent!\")</script>";

ought to send mail to the specified address, but does not. Or, at least, mail does not arrive. It works with all email addresses we have tried except those on this domain (ie. 'the-total-solution.com', which seems to suggest a problem with PHP, possibly relating to the fact that the domain contains hyphens? Emails from other sources are correctly reaching this address and others in the domain. Escaping by using the address "info@the\-total\-solution.com" doesn't solve the problem either. Having raised this problem with other developers, who also tested it, we can only conclude that the problem is in PHP.

I am not running PHP myself, my webserver is, so I can't give any information about PHP modules / backtrace.

Andrew Staffell

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-11 05:51 UTC] hholzgra@php.net
there finaly is an Apache OS now? great ;)

no, serious, what kind of operating system
are you runnig this on, windows or *nix?
 [2002-01-11 07:08 UTC] andrew at digitalhands dot co dot uk
I'm not running it, my ISP is. Anyway, excuse the error, it's on unix.
 [2002-01-11 08:00 UTC] hholzgra@php.net
then it's the mail server on that system that
doesn't get it, mail() on unix just puts together
a message from the paramters you gave it without
further processing and passes it transparently
to the sendmail command

please contact your ISP for further investigation
 [2002-01-11 08:20 UTC] andrew at digitalhands dot co dot uk
It's wrong to write this off as Bogus prematurely. It could still be the case that PHP has a problem with passing the correct information to sendmail. It may be that PHP needs to internally perform some kind of replacement on email addresses containing '-' characters (etc?) with escape characters. Perhaps when the sendmail gets the information from PHP, the email address is in an unacceptable format. Who knows? I've asked for diagnostics to be done on the mail server in question.
 [2002-01-11 08:55 UTC] hholzgra@php.net
it doesn't have to touch the '-' and it wont
none of the characters allowed in the domain part
of an email address needs quoting

for the windows implementation of mail() 
further investigation could be necessary
but the unix mail() implementation is so
straight forward that i'm really sure it
is not PHPs fault here 

if every domain with a '-' in it fails 
  -> blame your ISPs mail setup

if only certain domains fail
  -> maybe the mail server on that domain
     doesn't play well with the one your
     ISP uses

investigating the DNS MX entries for
the-total-solution.com you can see
that this domain has only *one* mail 
server, no fallback system, and the
mail server identifies itself as
"220 MAIL.the-total-solution.com NTMail"

not to unlikely that you have delivery
problems with that domain :(

 [2004-06-16 02:06 UTC] keyserj at hotmail dot com
I was having problems with the mail() function also. Sometimes it send the mail and it never arrives. I never get the error message. This is my code:

<?
$e=$_POST["email"];
$b=$_POST["name"];
$p="random pass";
$asunto="Welcome to this site ";
$cuerpo="Welcome ".$b." \n Your password for the account ".$e." is: ".$p;
$cuerpo .="\n To active this account: http://somesite.some/activar.php?acount=".$e;    	
if (mail($e,$asunto,$cuerpo)){
echo "Welcome ";
echo "$b";
echo "! your acount password was sent to $e<br>";
echo "Thanks!<br>";
echo "<a href='in.php'> Login </a>";}else{
echo "we have problems sending the mail";}
?>

Pacho
 [2021-03-11 11:07 UTC] garygarza197 at gmail dot com
It's wrong to write this off as Bogus prematurely. It could still be the case that PHP has a problem with passing the correct information to sendmail. It may be that PHP needs to internally perform some kind of replacement on email addresses containing https://www.myaarpmedicare.life/
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 02 23:01:29 2024 UTC