php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #620 mail() not RFC821/822 compliant (1/4)
Submitted: 1998-08-06 00:29 UTC Modified: 1998-08-13 15:54 UTC
From: walton at nordicdms dot com Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.2a OS: Win32
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: walton at nordicdms dot com
New email:
PHP Version: OS:

 

 [1998-08-06 00:29 UTC] walton at nordicdms dot com
I ran into problems using PHP mail() on Win32 with qmail.
As it turns out, the problems were caused by non-compliance
with RFCs in sendmail.c.  Thus, this series of bug reports.

<CRLF> line endings
-------------------
RFC822 Appendix D:
  message =  fields *( CRLF *text )
    ; Everything after
    ;  first null line
    ;  is message body
  field   =  field-name ":" [ field-body ] CRLF
  text    =  <any CHAR, including bare ; => atoms, specials,
             CR & bare LF, but NOT     ;  comments and
             including CRLF>           ;  quoted-strings are
                                       ;  NOT recognized.
RFC821 4.1.1:
  The mail data is terminated by a line containing only a
  period, that is the character sequence "<CRLF>.<CRLF>" 


Here are diffs that should allow mail() to work with qmail.
(I also moved Subject: before To:, per RFC recommendation,
and changed SNMP -> SMTP.)

sendmail.h
----------
> diff sendmail.h newsendmail.h
20c20
< #define	SNMP_SERVER_ERROR 9
---
> #define	SMTP_SERVER_ERROR 9

sendmail.c
----------
> diff sendmail.c newsendmail.c
289c289
< 	if ((res = Post("\n.\n")) != SUCCESS)
---
> 	if ((res = Post("\r\n.\r\n")) != SUCCESS)
327c327
< 	p += sprintf(p, "Date: %s, %02d %s %04d %02d:%02d:%02d %s%02d%02d\n",
---
> 	p += sprintf(p, "Date: %s, %02d %s %04d %02d:%02d:%02d %s%02d%02d\r\n",
340c340
< 		p += sprintf(p, "From: %s\n", RPath);
---
> 		p += sprintf(p, "From: %s\r\n", RPath);
342,343c342,343
< 	p += sprintf(p, "To: %s\n", mailTo);
< 	p += sprintf(p, "Subject: %s\n", Subject);
---
> 	p += sprintf(p, "Subject: %s\r\n", Subject);
> 	p += sprintf(p, "To: %s\r\n", mailTo);
345c345
< 		p += sprintf(p, "%s\n", xheaders);
---
> 		p += sprintf(p, "%s\r\n", xheaders);
351c351
< 	if ((res = Post("\n")) != SUCCESS)
---
> 	if ((res = Post("\r\n")) != SUCCESS)
470c470
< 		return (SNMP_SERVER_ERROR);
---
> 		return (SMTP_SERVER_ERROR);


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-08-13 15:54 UTC] shane
Patch has been applied.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 28 19:01:28 2024 UTC