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


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

mail working, not working.

Started bybill <william@TechServSys.com>
First post2013-09-23 11:15 -0400
Last post2013-09-24 06:58 -0400
Articles 4 — 3 participants

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


Contents

  mail working, not working. bill <william@TechServSys.com> - 2013-09-23 11:15 -0400
    Re: mail working, not working. "Peter H. Coffin" <hellsop@ninehells.com> - 2013-09-23 10:39 -0500
    Re: mail working, not working. Twayne <nobody@spamcop.net> - 2013-09-23 20:16 -0400
      Re: mail working, not working. bill <william@TechServSys.com> - 2013-09-24 06:58 -0400

#10841 — mail working, not working.

Frombill <william@TechServSys.com>
Date2013-09-23 11:15 -0400
Subjectmail working, not working.
Message-ID<l1plu1$ien$1@speranza.aioe.org>
In homage to Twane, I have a problem.
This code does not work (mail returns true, but the mail
  is not received):--------------------------------------------
			
	// mail notification to office
	$userx = urlencode($user);
	$emailTo = "office@example.com, william@example.com";
	$message = "A new user registered. ";
	$subject = "A new user registered: $userx";
	$headers = <<<END
From:office@example.com\n
END;
	
  	mail($emailTo,$subject,$message,$headers);
-----------------------------------------------------------

whereas this code does work  (different script)------------
	// now send notification
	// look up email address for msgTo
	$emailTo = fGetEmailAddy($msgTo);
	$name    = fGetRealName ($msgFrom);
	$toName  = fGetRealName ($msgTo);
	
	if ($broadcast)   { // broadcasting a non-clinical message
		$message = stripslashes($msgBody);
		$subject = "General information message from example.";		
		} //broadcasting a non-clinical message

	else   { // not a broadcast message
		$message = "$name left a message for you at 
https://example.com/email/login.php";
		$subject = "The MP Secure Server has a message.";
	    } //not a broadcast message
			  	
	$headers = <<<END
From:office@example.com\n
END;
	mail($emailTo,$subject,$message,$headers);
---------------------------------------------------------------


As far as I can see, they are identical.  But on the other hand, 
maybe I can't see.

Both scripts run on the same server, neither has errors with 
error_reporting(E_ALL); set at the top of the script.
Both require the same class.

in both examples the domain name was changed to "example" by 
hand; otherwise they are copied, pasted, and reformatted to fit news.

Any help and/or suggestions on how to proceed will be 
appreciated.  To make it more fun: earlier in the development 
process both worked just fine.

bill

[toc] | [next] | [standalone]


#10842

From"Peter H. Coffin" <hellsop@ninehells.com>
Date2013-09-23 10:39 -0500
Message-ID<slrnl40o54.kov.hellsop@nibelheim.ninehells.com>
In reply to#10841
On Mon, 23 Sep 2013 11:15:11 -0400, bill wrote:
> In homage to Twane, I have a problem.
> This code does not work (mail returns true, but the mail
>   is not received):--------------------------------------------
> 			
> 	// mail notification to office
> 	$userx = urlencode($user);
> 	$emailTo = "office@example.com, william@example.com";
> 	$message = "A new user registered. ";
> 	$subject = "A new user registered: $userx";
> 	$headers = <<<END
> From:office@example.com\n
> END;
> 	
>   	mail($emailTo,$subject,$message,$headers);
> -----------------------------------------------------------
>
> As far as I can see, they are identical.  But on the other hand, 
> maybe I can't see.
>
> Both scripts run on the same server, neither has errors with 
> error_reporting(E_ALL); set at the top of the script.
> Both require the same class.
>
> in both examples the domain name was changed to "example" by 
> hand; otherwise they are copied, pasted, and reformatted to fit news.
>
> Any help and/or suggestions on how to proceed will be 
> appreciated.  To make it more fun: earlier in the development 
> process both worked just fine.

Many "mail does not work" problems are not related to the PHP, but
rather to the mail itself being sent. Maybe the mail is rejected at the
remote end because it looks too much like spam, or because the sending
address is invalid, or because it's coming from a machine on a network
with a list of authorized machines to send mail and this thing is not
it. Mail() returning true only means that whatever the local submission
calls for completed successfully.

-- 
It's possible there had been armed autonomous droids at some point in 
the past, and one can almost imagine past issues of that galaxy's Risks
Digest.
              -- Anthony DeBoer, on SW: TPM

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


#10844

FromTwayne <nobody@spamcop.net>
Date2013-09-23 20:16 -0400
Message-ID<l1qllj$d0u$1@speranza.aioe.org>
In reply to#10841
On 2013-09-23 11:15 AM, bill wrote:
...
> This code does not work (mail returns true, but the mail
>   is not received):--------------------------------------------
>      // mail notification to office
>      $userx = urlencode($user);
>      $emailTo = "office@example.com, william@example.com";
>      $message = "A new user registered. ";
>      $subject = "A new user registered: $userx";
>      $headers = <<<END
> From:office@example.com\n
> END;
>       mail($emailTo,$subject,$message,$headers);
> -----------------------------------------------------------
> whereas this code does work  (different script)------------
>      // now send notification
>      // look up email address for msgTo
>      $emailTo = fGetEmailAddy($msgTo);
>      $name    = fGetRealName ($msgFrom);
>      $toName  = fGetRealName ($msgTo);
>      if ($broadcast)   { // broadcasting a non-clinical message
>          $message = stripslashes($msgBody);
>          $subject = "General information message from example.";
>          } //broadcasting a non-clinical message
>      else   { // not a broadcast message
>          $message = "$name left a message for you at
> https://example.com/email/login.php";
>          $subject = "The MP Secure Server has a message.";
>          } //not a broadcast message
>
>      $headers = <<<END
> From:office@example.com\n
> END;
>      mail($emailTo,$subject,$message,$headers);
> ---------------------------------------------------------------
>
>
> As far as I can see, they are identical.  But on the other hand, maybe I
> can't see.
>
> Both scripts run on the same server, neither has errors with
> error_reporting(E_ALL); set at the top of the script.
> Both require the same class.
>
...
> bill

I'll have to agree with Peter at this point. If mail() is being reported 
as true, then it's at least making it to be accepted at the server. Soo, 
something is likely up at the server end.

    Just for grins, I tried your first code here (sans encode) and it 
worked OK; I received the e-mail.

I see no Headers in your code but I do in the mail() statement; are they 
there and correct? Else I'd remove the $headers. I just used a name and 
a return path for my test here.

    Have you looked at your server error logs? Both local and remote?

    Depending on your server, it's probably not looking like spam or 
you'd have heard from them by now or your account would be temporarily 
disabled.

It might be worth asking the folks at your remote server what might be 
up and include the same details as you included here. I'd go ahead and 
open a support ticket and see what come out of it.
    Could it have anything to do with the encoding? I think I'd try 
removing it to see what happens at least; it's a quick test to do.

And of course, scrutinize the code very carefully for typos.

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


#10852

Frombill <william@TechServSys.com>
Date2013-09-24 06:58 -0400
Message-ID<l1rr7n$5q7$1@speranza.aioe.org>
In reply to#10844
On 9/23/2013 8:16 PM, Twayne wrote:
> On 2013-09-23 11:15 AM, bill wrote:
...
> I'll have to agree with Peter at this point. If mail() is being
> reported as true, then it's at least making it to be accepted at
> the server. Soo, something is likely up at the server end.
>
>     Just for grins, I tried your first code here (sans encode)
> and it worked OK; I received the e-mail.
>
> I see no Headers in your code but I do in the mail() statement;
> are they there and correct? Else I'd remove the $headers. I just
> used a name and a return path for my test here.
>
>     Have you looked at your server error logs? Both local and
> remote?
>
>     Depending on your server, it's probably not looking like spam
> or you'd have heard from them by now or your account would be
> temporarily disabled.
>
> It might be worth asking the folks at your remote server what
> might be up and include the same details as you included here.
> I'd go ahead and open a support ticket and see what come out of it.
>     Could it have anything to do with the encoding? I think I'd
> try removing it to see what happens at least; it's a quick test
> to do.
>
> And of course, scrutinize the code very carefully for typos.
LOL!
Will look in the server logs.

bill

[toc] | [prev] | [standalone]


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


csiph-web