SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Email Standards

  1. #1
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Email Standards

    Hi,

    I couldn't find any very helpful RFC's on this topic, only very specific ones to do with qmail,pine etc. What I'm looking for is some of the standards to do with emails. What I need to know are:

    • By standard, what should the headings be separated by? \n, \r or \r\n?
    • For text/html mail, what should the newlines in the body be separated by? \n, \r or \r\n?
    • What is the standard order for the email headers?
    • Is there a standard maximum line length in text/html messages?


    This is related to PHP, as I'd say PHP doesn't follow the standards with the amiling protocol, and/or leaves a lot of the checking up to the developers. Is there anything strange that PHP does with it's mail function that is not standard, or has caused bad emails?

    Thanks for your help,
    -Peter

  2. #2
    SitePoint Zealot
    Join Date
    Mar 2002
    Location
    Perth, Australia
    Posts
    157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Email Standards

    Hi petesmc

    The following RFC is pretty general about emails:
    http://www.faqs.org/rfcs/rfc2045.html


    • By standard, what should the headings be separated by? \n, \r or \r\n?

    Well, the above RFC says \r\n, but I always use \n and have not had problems with text or fancy mime emails. I can't remeber exactly why, maybe unix servers/PHP aren't as good with \r\n?

    • For text/html mail, what should the newlines in the body be separated by? \n, \r or \r\n?

    Same as above

    • What is the standard order for the email headers?

    I don't know about a complete official list, but the following seems to work:

    To: TO EMAIL
    Subject: Test email
    From: FROM EMAIL
    Reply-To: REPLY TO EMAIL
    MIME-Version: 1.0
    Content-Type: multipart/mixed;
    boundary="b_mix_c19349e02bb6d7e0575a7f42698b284f"

    • Is there a standard maximum line length in text/html messages?

    76 is the stated max length in the above RFC for quoted-printable format - which you can use the PHP function imap_8bit() to do for you (under IMAP, POP3 and NNTP functions)

    Hope that helps a bit

    Paul
    Paul Davey
    webmaster for Whitford Church of Christ


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •