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

Home » Imported messages » comp.lang.php » Trouble with sending e-mail from simple php script
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Trouble with sending e-mail from simple php script [message #176554 is a reply to message #176550] Mon, 09 January 2012 14:35 Go to previous messageGo to previous message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma:
Senior Member
C wrote:
> On Jan 9, 12:02 am, The Natural Philosopher <t...@invalid.invalid>
> wrote:
>> C wrote:
>>> On Jan 8, 4:34 pm, The Natural Philosopher <t...@invalid.invalid>
>>> wrote:
>>>> M. Strobel wrote:
>>>> > Am 08.01.2012 10:20, schrieb C:
>>>> >> Even if the message were rejected, I would still see something in that
>>>> >> frame, but I get only a blank frame. Client machine rejecting the
>>>> >> message should not even be noticed by this PHP script, or would it?
>>>> > You have to learn how to find and read the log files. Your script
>>>> > will not show errors if it dies.
>>>> > On Linux log files are only readable by root.
>>>> > /Str.
>>>> Probably the most common error when using mail() from within php on a
>>>> shared host is to fail to use the -f function to pass a valid sender
>>>> address to sendmail (or its analogue). Without that, the 'true' sender
>>>> is likely to be 'your-login-n...@hosting-omain.com' which will fail most
>>>> rudimentary validation and simply reject the mail.
>>>> I ALWAYS use the -f to set the sender to something like
>>>> 'webmas...@myvirtualdomson.com' and set up that virtual domain so that
>>>> webmaster is a valid known target for emails.
>>>> e.g.
>>>> mail($to, $subject, $body, $headers, "-f webmas...@mydomain.com");
>>>> is far more likely to get through anti-relay security in the hosts
>>>> mailer system.
>>>> Start by testing the host mailer with the above line, so
>>>> mail("m...@validmail.com","test message", "From:
>>>> anot...@validmail.com\r\n", -f "webmas...@mydomain.com");
>>>> is where you should start.
>>> I did that and got an error: Parse error: syntax error, unexpected
>>> T_CONSTANT_ENCAPSED_STRING
>> Then you typed it wrong
>>
>>>> If that fails to make it then you need to talk to the hosting company.
>>> I wrote the following test.php, uploaded it and tried it.
>>> <?php
>>
>>> mail("aaaa....@gmail.com","test message", "From:
>>> postmas...@example.org\r\n", -f "postmas...@example.org");
>>
>>> ?>
>>
>> did it work or not...?
>>
>
> No, it did not send me any mail (at least I did not receive any), and
> resulted in a blank page (but perhaps that is expected since there are
> no html or echo statements).
>

Indeed. Well in that case the mail interface at least is an issue: And
it looks like you have others.

Time for full error logging to see what's what.



>>
>>> My earlier code works well on two other sites of mine which are
>>> sitting on other shared servers.
>> So the problem is in the setting of this shared servers mail, which is
>> what I said..unless you have some other versions of php running.- Hide quoted text -
>
> Should I try to circumvent the problem in some way? Can one write the
> same thing in Javascript?
>
>> - Show quoted text -
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: scoping inside a block
Next Topic: Best PHP Training | PHP Development Training | PHP Training Institute
Goto Forum:
  

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

Current Time: Mon Nov 25 02:50:27 GMT 2024

Total time taken to generate the page: 0.05505 seconds