NYCPHP Meetup

NYPHP.org

[nycphp-talk] custom mail() with attachment problemusingRH7.3/Apache

Gabriel PREDA radical at amr.ro
Fri Jun 11 03:42:09 EDT 2004


 -        Problem lies in "mime_content_type" it's not a good function even
 if you have magic.mime... not to mention if you do not have it.
    It's sort of undocumented function : "Returns the MIME content type for
a
 file as determined by using information from the magic.mime file. Content
 types are returned in MIME format, like text/plain or
 application/octet-stream."
         But it says not what happens if it fails... or if the file has an
 unrecognizable mime. Try to use something else

 -        You're using a custom line break  although in PHP manual says:
"You
 must use \r\n to separate headers, although some Unix mail transfer agents
 may work with just a single newline (\n)." Also note SMTP and MINE
standards
 (RFC821/822 and ancestors) that require messages to have  \r\n . :)

 -         You do not have a charset definition in header: <start>
 Content-Type: text/plain; charset="iso-8859-1" </end>

 -         If your mail server requires authentication you need to
 communicate directly via sockets.

 -        A misssssconfigured SENDMAIL cand return false if it has some
 errors... even though the mail was sent...
 -        Take note that RFC 821 prohibits lines longer than 998 bytes.

 -        Speed-wize you should notice that mail() is extreeeeemly slower
 that "sockets"... if you send many emails in a loop PHP opens and closes a
 connection for every mai lyou send... compared with sockets when (if you
 write good code) you have only one connection opened and multiple mail
 sent...


 With all these problems... found in 5 minutes.. .what if I would have spent
 30 mins or 1 day...

 It's amaizing that we are able to send mail... :))

 Gabriel PREDA
 www.amr.ro




More information about the talk mailing list