|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[1998-08-13 15:54 UTC] shane
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Sun Jun 14 23:00:01 2026 UTC |
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);