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


Groups > comp.lang.php > #4322

Re: Trouble with sending e-mail from simple php script

From The Natural Philosopher <tnp@invalid.invalid>
Newsgroups comp.lang.php
Subject Re: Trouble with sending e-mail from simple php script
Date 2012-01-08 22:02 +0000
Organization albasani.net
Message-ID <jed3p9$437$4@news.albasani.net> (permalink)
References (1 earlier) <jeac4l$9fm$1@dont-email.me> <9640cd25-c0b2-4f09-96b7-a796826772ce@q8g2000yqa.googlegroups.com> <9mtmhtFnaeU1@mid.uni-berlin.de> <jec9hp$6o9$1@news.albasani.net> <78b7c024-e57e-4f8c-8d75-4535d52c8fb8@m20g2000vbf.googlegroups.com>

Show all headers | View raw


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:
> postmaster@example.org\r\n", -f "postmaster@example.org");
> 
> ?>

did it work or not...?
> 
> 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.

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Trouble with sending e-mail from simple php script C <wrong.address.1@gmail.com> - 2012-01-07 11:01 -0800
  Re: Trouble with sending e-mail from simple php script Luuk <Luuk@invalid.lan> - 2012-01-07 20:42 +0100
    Re: Trouble with sending e-mail from simple php script C <wrong.address.1@gmail.com> - 2012-01-08 01:17 -0800
      Re: Trouble with sending e-mail from simple php script Luuk <Luuk@invalid.lan> - 2012-01-08 19:09 +0100
  Re: Trouble with sending e-mail from simple php script Jerry Stuckle <jstucklex@attglobal.net> - 2012-01-07 16:06 -0500
    Re: Trouble with sending e-mail from simple php script C <wrong.address.1@gmail.com> - 2012-01-08 01:20 -0800
      Re: Trouble with sending e-mail from simple php script Jerry Stuckle <jstucklex@attglobal.net> - 2012-01-08 09:09 -0500
      Re: Trouble with sending e-mail from simple php script "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-01-08 15:12 +0100
        Re: Trouble with sending e-mail from simple php script The Natural Philosopher <tnp@invalid.invalid> - 2012-01-08 14:34 +0000
          Re: Trouble with sending e-mail from simple php script C <wrong.address.1@gmail.com> - 2012-01-08 10:51 -0800
            Re: Trouble with sending e-mail from simple php script The Natural Philosopher <tnp@invalid.invalid> - 2012-01-08 22:02 +0000
              Re: Trouble with sending e-mail from simple php script C <wrong.address.1@gmail.com> - 2012-01-09 05:27 -0800
                Re: Trouble with sending e-mail from simple php script The Natural Philosopher <tnp@invalid.invalid> - 2012-01-09 14:35 +0000
        Re: Trouble with sending e-mail from simple php script Jerry Stuckle <jstucklex@attglobal.net> - 2012-01-08 10:02 -0500
          Re: Trouble with sending e-mail from simple php script "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-01-08 16:33 +0100
            Re: Trouble with sending e-mail from simple php script Jerry Stuckle <jstucklex@attglobal.net> - 2012-01-08 10:39 -0500
              Re: Trouble with sending e-mail from simple php script "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-01-08 17:01 +0100
                Re: Trouble with sending e-mail from simple php script Jerry Stuckle <jstucklex@attglobal.net> - 2012-01-08 15:44 -0500
                Re: Trouble with sending e-mail from simple php script "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-01-08 23:53 +0100
                Re: Trouble with sending e-mail from simple php script Jerry Stuckle <jstucklex@attglobal.net> - 2012-01-08 19:00 -0500
                Re: Trouble with sending e-mail from simple php script C <wrong.address.1@gmail.com> - 2012-01-09 05:32 -0800
                Re: Trouble with sending e-mail from simple php script The Natural Philosopher <tnp@invalid.invalid> - 2012-01-09 14:32 +0000
                Re: Trouble with sending e-mail from simple php script Jerry Stuckle <jstucklex@attglobal.net> - 2012-01-09 10:04 -0500
  Re: Trouble with sending e-mail from simple php script Jeff North <jnorthau@yahoo.com.au> - 2012-01-09 02:29 +1100
    Re: Trouble with sending e-mail from simple php script C <wrong.address.1@gmail.com> - 2012-01-08 10:57 -0800
      Re: Trouble with sending e-mail from simple php script Jeff North <jnorthau@yahoo.com.au> - 2012-01-09 12:46 +1100
        Re: Trouble with sending e-mail from simple php script C <wrong.address.1@gmail.com> - 2012-01-09 05:39 -0800
      Re: Trouble with sending e-mail from simple php script Captain Paralytic <paul_lautman@yahoo.com> - 2012-01-09 04:36 -0800
        Re: Trouble with sending e-mail from simple php script C <wrong.address.1@gmail.com> - 2012-01-09 05:40 -0800
          Re: Trouble with sending e-mail from simple php script Captain Paralytic <paul_lautman@yahoo.com> - 2012-01-09 05:53 -0800
            Re: Trouble with sending e-mail from simple php script Tim Streater <timstreater@greenbee.net> - 2012-01-09 14:50 +0000
              Re: Trouble with sending e-mail from simple php script C <wrong.address.1@gmail.com> - 2012-01-09 07:34 -0800
              Re: Trouble with sending e-mail from simple php script Captain Paralytic <paul_lautman@yahoo.com> - 2012-01-09 07:40 -0800
                Re: Trouble with sending e-mail from simple php script Tim Streater <timstreater@greenbee.net> - 2012-01-09 17:00 +0000
                Re: Trouble with sending e-mail from simple php script Captain Paralytic <paul_lautman@yahoo.com> - 2012-01-10 01:58 -0800
                Re: Trouble with sending e-mail from simple php script Tim Streater <timstreater@greenbee.net> - 2012-01-10 10:18 +0000
                Re: Trouble with sending e-mail from simple php script Captain Paralytic <paul_lautman@yahoo.com> - 2012-01-10 02:20 -0800
            Re: Trouble with sending e-mail from simple php script C <wrong.address.1@gmail.com> - 2012-01-09 07:32 -0800
              Re: Trouble with sending e-mail from simple php script Tim Streater <timstreater@greenbee.net> - 2012-01-09 17:01 +0000
        Re: Trouble with sending e-mail from simple php script C <wrong.address.1@gmail.com> - 2012-01-09 07:30 -0800
  Re: Trouble with sending e-mail from simple php script "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-01-08 17:19 +0100
    Re: Trouble with sending e-mail from simple php script C <wrong.address.1@gmail.com> - 2012-01-08 11:02 -0800
      Re: Trouble with sending e-mail from simple php script "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-01-08 23:35 +0100
        Re: Trouble with sending e-mail from simple php script C <wrong.address.1@gmail.com> - 2012-01-09 05:28 -0800
          Re: Trouble with sending e-mail from simple php script The Natural Philosopher <tnp@invalid.invalid> - 2012-01-09 14:34 +0000
  Re: Trouble with sending e-mail from simple php script Luuk <Luuk@invalid.lan> - 2012-01-09 18:23 +0100

csiph-web