note 46261 deleted from function.mail by tomsommer
| From: | tomsommer@php.net | Date: | Tue, 05 Oct 2004 17:54:18 +0000 |
| Subject: | note 46261 deleted from function.mail by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-78038@lists.php.net to get a copy of this message | ||
Note Submitter: jeremiah (inlovewithGod.com)
----
Somebody reported changing the "\r\n" into "\n" which fixed their problem. I
would have to strongly advise against this! The standard is "\r\n" and *will* work!!
The problem is not in the "\r\n" in the body but I believe in PHP mail headers with
mail(). You might have to implement a custom SMTP sendmail function with sockets. I'm going to
do just this and report the results (and code) here in a few days.
Here's what you need to do however to stick with the standard:
Find mx record of recipient's email address domain with "getmxrr( )"
Connect to port 25
Go through this protocol. You'll need to check the first digit of the 3 digit number you
receive. I forget the exact standard, but 2's or 3's or good, and 5's are bad. I
forget about the rest. :)
////////////////////////////////////////////////
receive: 220 blahblahblah
send: HELO whoYouAre<CRLF> (your ip address will do)
receive: 250 blahblahblah
send: MAIL FROM: <sender@example.com><CRLF>
receive: 250 OK
send: RCPT TO: <recipient@example.com><CRLF>
receive: 250 OK
send: DATA<CRLF>
receive: 354 blahblahblah
send: Blah blah blah...<CRLF>
etc. etc. etc.<CRLF>
etc. etc. etc.<CRLF> (if anyline begins with a period ".", add another period to the
front; so ".blahipity" becomds "..blahipity")
etc. etc. etc.<CRLF>
<CRLF>.<CRLF> (a dot on a line by itself says you're done sending data. don't
ask me, its just the standard)
receive: 250 OK
send: QUIT<CRLF>
receive: 221 blahblahblah
////////////////////////////////////////////////
And then as long as all your receives are ok (begin with 2 or 3), you're fine. If not then
report an error.
I'll post my code and it's results here in a couple days.
- Jeremiah