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

Home » Imported messages » comp.lang.php » mail working, not working.
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: mail working, not working. [message #182882 is a reply to message #182879] Tue, 24 September 2013 00:16 Go to previous messageGo to previous message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma:
Senior Member
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(at)example(dot)com, william(at)example(dot)com";
> $message = "A new user registered. ";
> $subject = "A new user registered: $userx";
> $headers = <<<END
> From:office(at)example(dot)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(at)example(dot)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.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Setting & displaying Variables
Next Topic: Zend 200-500 Practice Questions and Answers
Goto Forum:
  

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

Current Time: Wed Nov 27 02:23:27 GMT 2024

Total time taken to generate the page: 0.03927 seconds