Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #9994 > unrolled thread
| Started by | Twayne <nobody@spamcop.net> |
|---|---|
| First post | 2013-06-30 19:29 -0400 |
| Last post | 2013-07-01 19:30 +0200 |
| Articles | 19 — 6 participants |
Back to article view | Back to comp.lang.php
PHP Mailto(); Twayne <nobody@spamcop.net> - 2013-06-30 19:29 -0400
Re: PHP Mailto(); "J.O. Aho" <user@example.net> - 2013-07-01 07:03 +0200
Re: PHP Mailto(); The Natural Philosopher <tnp@invalid.invalid> - 2013-07-01 10:08 +0100
Re: PHP Mailto(); Twayne <nobody@spamcop.net> - 2013-07-01 10:33 -0400
Re: PHP Mailto(); Twayne <nobody@spamcop.net> - 2013-07-01 10:23 -0400
Re: PHP Mailto(); Tim Streater <timstreater@greenbee.net> - 2013-07-01 16:28 +0100
Re: PHP Mailto(); bill <william@TechServSys.com> - 2013-07-01 07:50 -0400
Re: PHP Mailto(); The Natural Philosopher <tnp@invalid.invalid> - 2013-07-01 12:59 +0100
Re: PHP Mailto(); "J.O. Aho" <user@example.net> - 2013-07-01 14:47 +0200
Re: PHP Mailto(); The Natural Philosopher <tnp@invalid.invalid> - 2013-07-01 14:09 +0100
Re: PHP Mailto(); Twayne <nobody@spamcop.net> - 2013-07-01 10:10 -0400
Re: PHP Mailto(); Tim Streater <timstreater@greenbee.net> - 2013-07-01 16:34 +0100
Re: PHP Mailto(); The Natural Philosopher <tnp@invalid.invalid> - 2013-07-01 16:58 +0100
Re: PHP Mailto(); Tim Streater <timstreater@greenbee.net> - 2013-07-01 18:24 +0100
Re: PHP Mailto(); The Natural Philosopher <tnp@invalid.invalid> - 2013-07-01 18:47 +0100
Re: PHP Mailto(); Tim Streater <timstreater@greenbee.net> - 2013-07-01 20:43 +0100
Re: PHP Mailto(); "J.O. Aho" <user@example.net> - 2013-07-01 19:05 +0200
Re: PHP Mailto(); Christoph Michael Becker <cmbecker69@arcor.de> - 2013-07-01 19:21 +0200
Re: PHP Mailto(); "J.O. Aho" <user@example.net> - 2013-07-01 19:30 +0200
| From | Twayne <nobody@spamcop.net> |
|---|---|
| Date | 2013-06-30 19:29 -0400 |
| Subject | PHP Mailto(); |
| Message-ID | <kqqf0l$7gm$1@speranza.aioe.org> |
Hi,
Win 7, PHP 5.3.5, XAMPP local server, standard Unix remote server:
having a problem with mailto. It's working fine, but ... I can't figure
how to get it to contain all the information I want sent to me. I have
the following:
=========================
$header = "From: abuse@hcs-classof64.net";
$to = "abuse@hcs-classof64.net";
$subject = "HCS Abuse Form";
$header = "From: $name\r\n";
$header .= "Reply-To: abuse@hcs-classof64.net\r\n";
$header .= "Return-Path: abuse@hcs-classof64.net\r\n";
mail($to, $subject, $comments , $respond, $header);
========================
And it seems to work fine. But what I'd like to add to the mailto is
the following:
=======================
$browser = $_SERVER['HTTP_USER_AGENT'];
$ipAddress = $_SERVER['REMOTE_ADDR'];
=======================
I've tried the Headers method, simply adding them inlilne. No Good.
I've also tried "and"ing things together like " $comments . $respond "
for instance, but then they all run together and it's difficult to spot
the additional information since there are no line breaks.
For instance, in the mail I receive from the form, Id like to see, each
on their own line with a blank line between is possible:
1. $comments which is the actua verbiage from the visitor,
2, New line,
3. $respond,
4. New line,
4. $ip,
5, New line,
6 $browser
besides the requisite Subject and From lines.
Right now they're being echoed onscreen for my own purposes of
testing, but either way I can't get it all into the form that's sent to
me. I've been playing with this off & on for a week now and guess I need
help!
Can anyone advise me how to accomplish my goal?
TIA,
Twayne`
[toc] | [next] | [standalone]
| From | "J.O. Aho" <user@example.net> |
|---|---|
| Date | 2013-07-01 07:03 +0200 |
| Message-ID | <b3cgt2FdieqU1@mid.individual.net> |
| In reply to | #9994 |
On 01/07/13 01:29, Twayne wrote: > Hi, > > Win 7, PHP 5.3.5, XAMPP local server, standard Unix remote server: > > having a problem with mailto. It's working fine, but ... I can't figure > how to get it to contain all the information I want sent to me. I have > the following: > ========================= > $header = "From: abuse@hcs-classof64.net"; > $to = "abuse@hcs-classof64.net"; > $subject = "HCS Abuse Form"; > $header = "From: $name\r\n"; you forgot the . in front of the =, as now you replace the original From. > $header .= "Reply-To: abuse@hcs-classof64.net\r\n"; No need of this, if you use the original From. > $header .= "Return-Path: abuse@hcs-classof64.net\r\n"; > > mail($to, $subject, $comments , $respond, $header); you know that you are sending your headers to the "sendmail command", see www.php.net/manual/en/function.mail.php mail($to, $subject, $comments, $header); > ======================== > And it seems to work fine. But what I'd like to add to the mailto is > the following: > ======================= > $browser = $_SERVER['HTTP_USER_AGENT']; > $ipAddress = $_SERVER['REMOTE_ADDR']; > ======================= > > I've tried the Headers method, simply adding them inlilne. No Good. > I've also tried "and"ing things together like " $comments . $respond " > for instance, but then they all run together and it's difficult to spot > the additional information since there are no line breaks. If you want to add something to the header, then use "X-something: data\r\n" Don't use two "From:", use "X-Sender:" for the $name, don't forget to sanitize the user input or else you will end up with mail header injections. $header .= "X-Sender: $name\r\n"; // needs sanitation $header .= "X-UserAgent: $browser\r\n"; // needs sanitation $header .= "X-IP: $ipAddress\r\n"; To lessen risk for header injections, include those in the body/message. $comments .= "Abuse Sender: $name\n"; // needs sanitation $comments .= "User Agent: $browser\n"; // needs sanitation $comments .= "IP: $ipAddress\n"; -- //Aho
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2013-07-01 10:08 +0100 |
| Message-ID | <kqrguj$haa$1@news.albasani.net> |
| In reply to | #10000 |
On 01/07/13 06:03, J.O. Aho wrote: > On 01/07/13 01:29, Twayne wrote: >> Hi, >> >> Win 7, PHP 5.3.5, XAMPP local server, standard Unix remote server: >> >> having a problem with mailto. It's working fine, but ... I can't figure >> how to get it to contain all the information I want sent to me. I have >> the following: >> ========================= >> $header = "From: abuse@hcs-classof64.net"; >> $to = "abuse@hcs-classof64.net"; >> $subject = "HCS Abuse Form"; >> $header = "From: $name\r\n"; > > you forgot the . in front of the =, as now you replace the original From. > >> $header .= "Reply-To: abuse@hcs-classof64.net\r\n"; > > No need of this, if you use the original From. > >> $header .= "Return-Path: abuse@hcs-classof64.net\r\n"; >> >> mail($to, $subject, $comments , $respond, $header); > > you know that you are sending your headers to the "sendmail command", > see www.php.net/manual/en/function.mail.php > > mail($to, $subject, $comments, $header); > >> ======================== >> And it seems to work fine. But what I'd like to add to the mailto is >> the following: >> ======================= >> $browser = $_SERVER['HTTP_USER_AGENT']; >> $ipAddress = $_SERVER['REMOTE_ADDR']; >> ======================= >> >> I've tried the Headers method, simply adding them inlilne. No Good. >> I've also tried "and"ing things together like " $comments . $respond " >> for instance, but then they all run together and it's difficult to spot >> the additional information since there are no line breaks. > > If you want to add something to the header, then use > "X-something: data\r\n" > Be aware that some combinations of never identified php configurations and/or mailer MTAS do not seem to like the extra "\r" even though its strict RFC compliant. I spent several hours trying various combinations before I settled on a simple "\n" only, and mail worked as expected. Where PHP or the MTA was adding in the "\r" automatically I never discovered, but something was. (linux system) > Don't use two "From:", use "X-Sender:" for the $name, don't forget to > sanitize the user input or else you will end up with mail header > injections. > > $header .= "X-Sender: $name\r\n"; // needs sanitation > $header .= "X-UserAgent: $browser\r\n"; // needs sanitation > $header .= "X-IP: $ipAddress\r\n"; > > To lessen risk for header injections, include those in the body/message. > > $comments .= "Abuse Sender: $name\n"; // needs sanitation > $comments .= "User Agent: $browser\n"; // needs sanitation > $comments .= "IP: $ipAddress\n"; > -- Ineptocracy (in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
[toc] | [prev] | [next] | [standalone]
| From | Twayne <nobody@spamcop.net> |
|---|---|
| Date | 2013-07-01 10:33 -0400 |
| Message-ID | <kqs3v6$4ic$1@speranza.aioe.org> |
| In reply to | #10001 |
On 2013-07-01 5:08 AM, The Natural Philosopher wrote: > On 01/07/13 06:03, J.O. Aho wrote: >> On 01/07/13 01:29, Twayne wrote: >>> Hi, >>> >>> Win 7, PHP 5.3.5, XAMPP local server, standard Unix remote server: >>> >>> having a problem with mailto. It's working fine, but ... I can't figure >>> how to get it to contain all the information I want sent to me. I have >>> the following: >>> ========================= >>> $header = "From: abuse@hcs-classof64.net"; >>> $to = "abuse@hcs-classof64.net"; >>> $subject = "HCS Abuse Form"; >>> $header = "From: $name\r\n"; >> >> you forgot the . in front of the =, as now you replace the original From. >> >>> $header .= "Reply-To: abuse@hcs-classof64.net\r\n"; >> >> No need of this, if you use the original From. >> >>> $header .= "Return-Path: abuse@hcs-classof64.net\r\n"; >>> >>> mail($to, $subject, $comments , $respond, $header); >> >> you know that you are sending your headers to the "sendmail command", >> see www.php.net/manual/en/function.mail.php >> >> mail($to, $subject, $comments, $header); >> >>> ======================== >>> And it seems to work fine. But what I'd like to add to the mailto is >>> the following: >>> ======================= >>> $browser = $_SERVER['HTTP_USER_AGENT']; >>> $ipAddress = $_SERVER['REMOTE_ADDR']; >>> ======================= >>> >>> I've tried the Headers method, simply adding them inlilne. No Good. >>> I've also tried "and"ing things together like " $comments . $respond " >>> for instance, but then they all run together and it's difficult to spot >>> the additional information since there are no line breaks. >> >> If you want to add something to the header, then use >> "X-something: data\r\n" >> > > Be aware that some combinations of never identified php configurations > and/or mailer MTAS do not seem to like the extra "\r" even though its > strict RFC compliant. > I spent several hours trying various combinations before I settled on a > simple "\n" only, and mail worked as expected. Well at least I know what to experiment with anyway<grin. Thanks. > > Where PHP or the MTA was adding in the "\r" automatically I never > discovered, but something was. (linux system) I had that situation too; removing any newline of any sort from the particular statement corrected it. > > >> Don't use two "From:", use "X-Sender:" for the $name, don't forget to >> sanitize the user input or else you will end up with mail header >> injections. >> >> $header .= "X-Sender: $name\r\n"; // needs sanitation >> $header .= "X-UserAgent: $browser\r\n"; // needs sanitation >> $header .= "X-IP: $ipAddress\r\n"; >> >> To lessen risk for header injections, include those in the body/message. >> >> $comments .= "Abuse Sender: $name\n"; // needs sanitation >> $comments .= "User Agent: $browser\n"; // needs sanitation >> $comments .= "IP: $ipAddress\n"; >> > > Thanks Nat, Twayne`
[toc] | [prev] | [next] | [standalone]
| From | Twayne <nobody@spamcop.net> |
|---|---|
| Date | 2013-07-01 10:23 -0400 |
| Message-ID | <kqs3dn$2s7$1@speranza.aioe.org> |
| In reply to | #10000 |
On 2013-07-01 1:03 AM, J.O. Aho wrote: > On 01/07/13 01:29, Twayne wrote: >> Hi, >> >> Win 7, PHP 5.3.5, XAMPP local server, standard Unix remote server: >> >> having a problem with mailto. It's working fine, but ... I can't figure >> how to get it to contain all the information I want sent to me. I have >> ========================= ... > > If you want to add something to the header, then use > "X-something: data\r\n" > > Don't use two "From:", use "X-Sender:" for the $name, don't forget to > sanitize the user input or else you will end up with mail header > injections. > > $header .= "X-Sender: $name\r\n"; // needs sanitation > $header .= "X-UserAgent: $browser\r\n"; // needs sanitation > $header .= "X-IP: $ipAddress\r\n"; > > To lessen risk for header injections, include those in the body/message. > > $comments .= "Abuse Sender: $name\n"; // needs sanitation > $comments .= "User Agent: $browser\n"; // needs sanitation > $comments .= "IP: $ipAddress\n"; > That's a keeper! Thanks much for sharing. X-sender I hadn't thought of and I'll try it. As for \r\n vs \n, I'd forgotten all about because I normally use (not successfully in this case) <br />. I've also been reading about PHP EOL; any opinions on that? Other than knowing when to use it, it sounds like it might be handy if it's not deprecated; haven't looked it up yet. Thanks much, Twayne`
[toc] | [prev] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2013-07-01 16:28 +0100 |
| Message-ID | <timstreater-4A81C9.16285501072013@news.individual.net> |
| In reply to | #10007 |
In article <kqs3dn$2s7$1@speranza.aioe.org>, Twayne <nobody@spamcop.net> wrote: > On 2013-07-01 1:03 AM, J.O. Aho wrote: > > On 01/07/13 01:29, Twayne wrote: > >> Hi, > >> > >> Win 7, PHP 5.3.5, XAMPP local server, standard Unix remote server: > >> > >> having a problem with mailto. It's working fine, but ... I can't figure > >> how to get it to contain all the information I want sent to me. I have > > >> ========================= > > ... > > > > If you want to add something to the header, then use > > "X-something: data\r\n" > > > > Don't use two "From:", use "X-Sender:" for the $name, don't forget to > > sanitize the user input or else you will end up with mail header > > injections. > > > > $header .= "X-Sender: $name\r\n"; // needs sanitation > > $header .= "X-UserAgent: $browser\r\n"; // needs sanitation > > $header .= "X-IP: $ipAddress\r\n"; > > > > To lessen risk for header injections, include those in the body/message. > > > > $comments .= "Abuse Sender: $name\n"; // needs sanitation > > $comments .= "User Agent: $browser\n"; // needs sanitation > > $comments .= "IP: $ipAddress\n"; > > > > That's a keeper! Thanks much for sharing. > > X-sender I hadn't thought of and I'll try it. As for \r\n vs \n, I'd > forgotten all about because I normally use (not successfully in this > case) <br />. > > I've also been reading about PHP EOL; any opinions on that? Other than > knowing when to use it, it sounds like it might be handy if it's not > deprecated; haven't looked it up yet. Since the standards specify CRLF I do this: $lf = chr (10); $cr = chr (13); $nl = $cr . $lf; and use $nl throughout. You might also want to snoop on your traffic to see what gets sent. I use PacketPeeper for this. -- Tim "That excessive bail ought not to be required, nor excessive fines imposed, nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
[toc] | [prev] | [next] | [standalone]
| From | bill <william@TechServSys.com> |
|---|---|
| Date | 2013-07-01 07:50 -0400 |
| Message-ID | <kqrqd5$94m$2@speranza.aioe.org> |
| In reply to | #9994 |
On 6/30/2013 7:29 PM, Twayne wrote: > Hi,; > ======================= > > I've tried the Headers method, simply adding them inlilne. No Good. > I've also tried "and"ing things together like " $comments . > $respond " for instance, but then they all run together and it's > difficult to spot the additional information since there are no > line breaks. > > Twayne` I do believe that you use \n for a new line in the body of the email.
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2013-07-01 12:59 +0100 |
| Message-ID | <kqrquc$58e$2@news.albasani.net> |
| In reply to | #10002 |
On 01/07/13 12:50, bill wrote: > On 6/30/2013 7:29 PM, Twayne wrote: >> Hi,; >> ======================= >> >> I've tried the Headers method, simply adding them inlilne. No Good. >> I've also tried "and"ing things together like " $comments . >> $respond " for instance, but then they all run together and it's >> difficult to spot the additional information since there are no >> line breaks. >> >> Twayne` > > I do believe that you use \n for a new line in the body of the email. > correct. In full spec you should use "\r\n" for headers, but the mail program in PHP seems to accept \n better. In the body you can use '\n' without issues. -- Ineptocracy (in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
[toc] | [prev] | [next] | [standalone]
| From | "J.O. Aho" <user@example.net> |
|---|---|
| Date | 2013-07-01 14:47 +0200 |
| Message-ID | <alpine.LNX.2.00.1307011439170.31599@quad.local.lan> |
| In reply to | #10003 |
On Mon, 1 Jul 2013, The Natural Philosopher wrote:
> On 01/07/13 12:50, bill wrote:
>> On 6/30/2013 7:29 PM, Twayne wrote:
>> >
>> > I've tried the Headers method, simply adding them inlilne. No Good.
>> > I've also tried "and"ing things together like " $comments .
>> > $respond " for instance, but then they all run together and it's
>> > difficult to spot the additional information since there are no
>> > line breaks.
>>
>> I do believe that you use \n for a new line in the body of the email.
>>
> correct. In full spec you should use "\r\n" for headers, but the mail program
> in PHP seems to accept \n better.
If I remember this correct, it's different in ms-windows and Linux/Unix with
the "best" option in the header \n or \r\n, think the later is needed in
ms-windows. There was some issues PHP 5.2 -> PHP 5.3 where using \r\n on
Linux/Unix broke and people started to change to just use \n.
To make it more portable, you could use PHP_EOL instead, then it should work
fine in which ever environment without need of code change.
> In the body you can use '\n' without issues.
Usually \n works in body like a charm, but I think some old clients may get
some display issues if you use an ms-dos charset in the mail header for the mail,
but I think that is quite rare and shouldn't need to be tought of.
--
//Aho
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2013-07-01 14:09 +0100 |
| Message-ID | <kqrv1i$dol$1@news.albasani.net> |
| In reply to | #10004 |
On 01/07/13 13:47, J.O. Aho wrote: > On Mon, 1 Jul 2013, The Natural Philosopher wrote: >> On 01/07/13 12:50, bill wrote: >>> On 6/30/2013 7:29 PM, Twayne wrote: >>> > > I've tried the Headers method, simply adding them inlilne. No >>> Good. >>> > I've also tried "and"ing things together like " $comments . >>> > $respond " for instance, but then they all run together and it's >>> > difficult to spot the additional information since there are no >>> > line breaks. >>> >>> I do believe that you use \n for a new line in the body of the email. >>> >> correct. In full spec you should use "\r\n" for headers, but the mail >> program in PHP seems to accept \n better. > > If I remember this correct, it's different in ms-windows and > Linux/Unix with the "best" option in the header \n or \r\n, think the > later is needed in ms-windows. There was some issues PHP 5.2 -> PHP > 5.3 where using \r\n on Linux/Unix broke and people started to change > to just use \n. > To make it more portable, you could use PHP_EOL instead, then it > should work fine in which ever environment without need of code change. > > That is a thought. I'd forgotten PHP_EOL > >> In the body you can use '\n' without issues. > > Usually \n works in body like a charm, but I think some old clients > may get some display issues if you use an ms-dos charset in the mail > header for the mail, but I think that is quite rare and shouldn't need > to be tought of. > -- Ineptocracy (in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
[toc] | [prev] | [next] | [standalone]
| From | Twayne <nobody@spamcop.net> |
|---|---|
| Date | 2013-07-01 10:10 -0400 |
| Message-ID | <kqs2ks$ln$1@speranza.aioe.org> |
| In reply to | #10002 |
On 2013-07-01 7:50 AM, bill wrote: > On 6/30/2013 7:29 PM, Twayne wrote: >> Hi,; >> ======================= >> >> I've tried the Headers method, simply adding them inlilne. No Good. >> I've also tried "and"ing things together like " $comments . >> $respond " for instance, but then they all run together and it's >> difficult to spot the additional information since there are no >> line breaks. >> >> Twayne` > > I do believe that you use \n for a new line in the body of the email. > If anyone is interested, there seems to be a pretty good Q&A for EOL at: http://stackoverflow.com/questions/128560/when-do-i-use-the-php-constant-php-eol Almost all the pros & cons are sensible, thought-out comments. Twayne`
[toc] | [prev] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2013-07-01 16:34 +0100 |
| Message-ID | <timstreater-FA4C2E.16342501072013@news.individual.net> |
| In reply to | #10006 |
In article <kqs2ks$ln$1@speranza.aioe.org>, Twayne <nobody@spamcop.net> wrote: > On 2013-07-01 7:50 AM, bill wrote: > > On 6/30/2013 7:29 PM, Twayne wrote: > >> Hi,; > >> I've tried the Headers method, simply adding them inlilne. No Good. > >> I've also tried "and"ing things together like " $comments . > >> $respond " for instance, but then they all run together and it's > >> difficult to spot the additional information since there are no > >> line breaks. > > I do believe that you use \n for a new line in the body of the email. > > > > If anyone is interested, there seems to be a pretty good Q&A for EOL at: > > http://stackoverflow.com/questions/128560/when-do-i-use-the-php-constant-php-e > ol > > Almost all the pros & cons are sensible, thought-out comments. How about reading the RFCs to see what you are *actually* supposed to do. Such as RFC 2821 section 2.3.7. -- Tim "That excessive bail ought not to be required, nor excessive fines imposed, nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2013-07-01 16:58 +0100 |
| Message-ID | <kqs8vr$38l$1@news.albasani.net> |
| In reply to | #10010 |
On 01/07/13 16:34, Tim Streater wrote: > In article <kqs2ks$ln$1@speranza.aioe.org>, Twayne > <nobody@spamcop.net> wrote: > >> On 2013-07-01 7:50 AM, bill wrote: >> > On 6/30/2013 7:29 PM, Twayne wrote: >> >> Hi,; > >> >> I've tried the Headers method, simply adding them inlilne. No Good. >> >> I've also tried "and"ing things together like " $comments . >> >> $respond " for instance, but then they all run together and it's >> >> difficult to spot the additional information since there are no >> >> line breaks. > >> > I do believe that you use \n for a new line in the body of the email. >> > >> >> If anyone is interested, there seems to be a pretty good Q&A for EOL at: >> >> http://stackoverflow.com/questions/128560/when-do-i-use-the-php-constant-php-e >> >> ol >> >> Almost all the pros & cons are sensible, thought-out comments. > > How about reading the RFCs to see what you are *actually* supposed to > do. Such as RFC 2821 section 2.3.7. > The problem tim, is that in my case, that is exactly what I DID do, but it came out WRONG I spent a merry morning trying everything, before concluding that somewhere between a PHP statement and a mail recieved at the far end, something was tampering with new lines in the headers. I couldn't actually easily check the sendmail (or analogue thereof) dialogue , but I was able to see te 'wrongness' in spooled mail sent to unreachable targets. That hung around long enough to disassemble. My guess is that PHP tries to be smart. Sometimes too smart for its own good. -- Ineptocracy (in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
[toc] | [prev] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2013-07-01 18:24 +0100 |
| Message-ID | <timstreater-FFBCA2.18240201072013@news.individual.net> |
| In reply to | #10011 |
In article <kqs8vr$38l$1@news.albasani.net>, The Natural Philosopher <tnp@invalid.invalid> wrote: > On 01/07/13 16:34, Tim Streater wrote: > > In article <kqs2ks$ln$1@speranza.aioe.org>, Twayne > > <nobody@spamcop.net> wrote: > > > >> On 2013-07-01 7:50 AM, bill wrote: > >> > On 6/30/2013 7:29 PM, Twayne wrote: > >> >> Hi,; > > > >> >> I've tried the Headers method, simply adding them inlilne. No Good. > >> >> I've also tried "and"ing things together like " $comments . > >> >> $respond " for instance, but then they all run together and it's > >> >> difficult to spot the additional information since there are no > >> >> line breaks. > > > >> > I do believe that you use \n for a new line in the body of the email. > >> > > >> > >> If anyone is interested, there seems to be a pretty good Q&A for EOL at: > >> > >> http://stackoverflow.com/questions/128560/when-do-i-use-the-php-constant-ph > >> p-e > >> > >> ol > >> > >> Almost all the pros & cons are sensible, thought-out comments. > > > > How about reading the RFCs to see what you are *actually* supposed to > > do. Such as RFC 2821 section 2.3.7. > > > The problem tim, is that in my case, that is exactly what I DID do, but > it came out WRONG > I spent a merry morning trying everything, before concluding that > somewhere between a PHP statement and a mail recieved at the far end, > something was tampering with new lines in the headers. > > I couldn't actually easily check the sendmail (or analogue thereof) > dialogue , but I was able to see te 'wrongness' in spooled mail sent to > unreachable targets. That hung around long enough to disassemble. > > My guess is that PHP tries to be smart. Sometimes too smart for its own > good. Thass one reason I rolled my own. Besides which it was fun. -- Tim "That excessive bail ought not to be required, nor excessive fines imposed, nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2013-07-01 18:47 +0100 |
| Message-ID | <kqsfcb$h4b$2@news.albasani.net> |
| In reply to | #10014 |
On 01/07/13 18:24, Tim Streater wrote: > In article <kqs8vr$38l$1@news.albasani.net>, > The Natural Philosopher <tnp@invalid.invalid> wrote: > >> On 01/07/13 16:34, Tim Streater wrote: >> > In article <kqs2ks$ln$1@speranza.aioe.org>, Twayne > >> <nobody@spamcop.net> wrote: >> > >> >> On 2013-07-01 7:50 AM, bill wrote: >> >> > On 6/30/2013 7:29 PM, Twayne wrote: >> >> >> Hi,; >> > >> >> >> I've tried the Headers method, simply adding them inlilne. No >> Good. >> >> >> I've also tried "and"ing things together like " $comments . >> >> >> $respond " for instance, but then they all run together and it's >> >> >> difficult to spot the additional information since there are no >> >> >> line breaks. >> > >> >> > I do believe that you use \n for a new line in the body of the >> email. >> >> > >> >> >> >> If anyone is interested, there seems to be a pretty good Q&A for >> EOL at: >> >> >> >> >> http://stackoverflow.com/questions/128560/when-do-i-use-the-php-constant-ph >> >> p-e >> >> >> ol >> >> >> >> Almost all the pros & cons are sensible, thought-out comments. >> > >> > How about reading the RFCs to see what you are *actually* supposed >> to > do. Such as RFC 2821 section 2.3.7. >> > >> The problem tim, is that in my case, that is exactly what I DID do, >> but it came out WRONG >> I spent a merry morning trying everything, before concluding that >> somewhere between a PHP statement and a mail recieved at the far end, >> something was tampering with new lines in the headers. >> >> I couldn't actually easily check the sendmail (or analogue thereof) >> dialogue , but I was able to see te 'wrongness' in spooled mail sent >> to unreachable targets. That hung around long enough to disassemble. >> >> My guess is that PHP tries to be smart. Sometimes too smart for its >> own good. > > Thass one reason I rolled my own. Besides which it was fun. > yerrss. I did a simple smtp client in C, but not in PHP. -- Ineptocracy (in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
[toc] | [prev] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2013-07-01 20:43 +0100 |
| Message-ID | <timstreater-856BBE.20434201072013@news.individual.net> |
| In reply to | #10016 |
In article <kqsfcb$h4b$2@news.albasani.net>, The Natural Philosopher <tnp@invalid.invalid> wrote: > On 01/07/13 18:24, Tim Streater wrote: > > In article <kqs8vr$38l$1@news.albasani.net>, > > The Natural Philosopher <tnp@invalid.invalid> wrote: > > > >> On 01/07/13 16:34, Tim Streater wrote: > >> > In article <kqs2ks$ln$1@speranza.aioe.org>, Twayne > > >> <nobody@spamcop.net> wrote: > >> > > >> >> On 2013-07-01 7:50 AM, bill wrote: > >> >> > On 6/30/2013 7:29 PM, Twayne wrote: > >> >> >> Hi,; > >> > > >> >> >> I've tried the Headers method, simply adding them inlilne. No > >> Good. > >> >> >> I've also tried "and"ing things together like " $comments . > >> >> >> $respond " for instance, but then they all run together and it's > >> >> >> difficult to spot the additional information since there are no > >> >> >> line breaks. > >> > > >> >> > I do believe that you use \n for a new line in the body of the > >> email. > >> >> > > >> >> > >> >> If anyone is interested, there seems to be a pretty good Q&A for > >> EOL at: > >> >> > >> >> > >> http://stackoverflow.com/questions/128560/when-do-i-use-the-php-constant-ph > >> >> p-e >> > >> >> ol > >> >> > >> >> Almost all the pros & cons are sensible, thought-out comments. > >> > > >> > How about reading the RFCs to see what you are *actually* supposed > >> to > do. Such as RFC 2821 section 2.3.7. > >> > > >> The problem tim, is that in my case, that is exactly what I DID do, > >> but it came out WRONG > >> I spent a merry morning trying everything, before concluding that > >> somewhere between a PHP statement and a mail recieved at the far end, > >> something was tampering with new lines in the headers. > >> > >> I couldn't actually easily check the sendmail (or analogue thereof) > >> dialogue , but I was able to see te 'wrongness' in spooled mail sent > >> to unreachable targets. That hung around long enough to disassemble. > >> > >> My guess is that PHP tries to be smart. Sometimes too smart for its > >> own good. > > > > Thass one reason I rolled my own. Besides which it was fun. > > > yerrss. I did a simple smtp client in C, but not in PHP. Mine's a full-blown email client. -- Tim "That excessive bail ought not to be required, nor excessive fines imposed, nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
[toc] | [prev] | [next] | [standalone]
| From | "J.O. Aho" <user@example.net> |
|---|---|
| Date | 2013-07-01 19:05 +0200 |
| Message-ID | <b3dr7aFmi3vU1@mid.individual.net> |
| In reply to | #10010 |
On 01/07/13 17:34, Tim Streater wrote: > In article <kqs2ks$ln$1@speranza.aioe.org>, Twayne <nobody@spamcop.net> > wrote: > >> On 2013-07-01 7:50 AM, bill wrote: >> > On 6/30/2013 7:29 PM, Twayne wrote: >> >> Hi,; > >> >> I've tried the Headers method, simply adding them inlilne. No Good. >> >> I've also tried "and"ing things together like " $comments . >> >> $respond " for instance, but then they all run together and it's >> >> difficult to spot the additional information since there are no >> >> line breaks. > >> > I do believe that you use \n for a new line in the body of the email. >> > >> >> If anyone is interested, there seems to be a pretty good Q&A for EOL at: >> >> http://stackoverflow.com/questions/128560/when-do-i-use-the-php-constant-php-e >> >> ol >> >> Almost all the pros & cons are sensible, thought-out comments. > > How about reading the RFCs to see what you are *actually* supposed to > do. Such as RFC 2821 section 2.3.7. RFC is one thing and PHP uses some replacing of carriage return and new lines to make the data sent to the mail sever correct, which makes it better to have \r\n on ms-windows, \r on OSX/MacOS and \n on Linux/Unix. -- //Aho
[toc] | [prev] | [next] | [standalone]
| From | Christoph Michael Becker <cmbecker69@arcor.de> |
|---|---|
| Date | 2013-07-01 19:21 +0200 |
| Message-ID | <51d1ba64$0$6547$9b4e6d93@newsspool4.arcor-online.net> |
| In reply to | #10012 |
J.O. Aho wrote: > RFC is one thing and PHP uses some replacing of carriage return and new > lines to make the data sent to the mail sever correct, which makes it > better to have \r\n on ms-windows, \r on OSX/MacOS and \n on Linux/Unix. According to the documentation on php.net[1] it is not PHP that replaces the line breaks, but some MTAs: | If messages are not received, try using a LF (\n) only. Some Unix | mail transfer agents (most notably » qmail) replace LF by CRLF | automatically (which leads to doubling CR if CRLF is used). This | should be a last resort, as it does not comply with » RFC 2822. [1] <http://php.net/manual/en/function.mail.php> -- Christoph M. Becker
[toc] | [prev] | [next] | [standalone]
| From | "J.O. Aho" <user@example.net> |
|---|---|
| Date | 2013-07-01 19:30 +0200 |
| Message-ID | <b3dslcFmsk8U1@mid.individual.net> |
| In reply to | #10013 |
On 01/07/13 19:21, Christoph Michael Becker wrote: > J.O. Aho wrote: >> RFC is one thing and PHP uses some replacing of carriage return and new >> lines to make the data sent to the mail sever correct, which makes it >> better to have \r\n on ms-windows, \r on OSX/MacOS and \n on Linux/Unix. > > According to the documentation on php.net[1] it is not PHP that replaces > the line breaks, but some MTAs: Maybe some does, but there is also this nice comment: /* This pattern converts all single occurences of \n (Unix) * withour a leading \r to \r\n and all occurences of \r (Mac) * without a trailing \n to \r\n * Thx to Nibbler from ircnet/#linuxger */ -- //Aho
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.php
csiph-web