Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>While that should work, I would strongly recommend using a prebuilt Mail/SMTP class such as <a href="http://framework.zend.com/manual/en/zend.mail.html" rel="noreferrer">Zend_Mail</a>. While I don't think the whole Zend Framework is the cat's pajamas, I do have a very good opinion of their mail handling code.</p> <p>EDIT: I should also add that using a prebuilt Mail/SMTP class will abstract almost all of the complexity/structure of multi-part emails.</p> <p><strong>Update 2009-05-06:</strong> Answering your question directly.</p> <blockquote> <ul> <li>Are the UTF-8 declarations and attachments well formed?</li> </ul> </blockquote> <p>They look decent enough.</p> <blockquote> <ul> <li>Do I need to use <code>quoted_printable_decode()</code>? If yes, where?</li> </ul> </blockquote> <p>No. You would want to use <code>quoted_printable_decode()</code> only if you are decoding an email message. Not when you are encoding one. Should you use <strong><code>quoted_printable_encode()</code></strong>? I will discuss this next.</p> <blockquote> <ul> <li>Content-Transfer-Encoding: 7 or 8 bits? I've always seen 7 but since I'm sending a UTF-8 encoded mail I'm not sure.</li> </ul> </blockquote> <p>Only use 8bit encoding if you know that the destination SMTP server can support it. However, since you are passing your email off to the local MTA, I wouldn't recommend setting this value. The default value is 7bit encoding, but it has it's own set of restrictions: up to 998 octets per line of the code range 1-127 with CR and LF only allowed to appear as part of the CRLF line ending (<a href="http://tools.ietf.org/html/rfc2045#section-2.7" rel="noreferrer">http://tools.ietf.org/html/rfc2045#section-2.7</a>).</p> <p>I would recommend you use the Quoted-Printable (<a href="http://tools.ietf.org/html/rfc2045#section-6.7" rel="noreferrer">http://tools.ietf.org/html/rfc2045#section-6.7</a>) Content-Transfer-Encoding. Where you are calling <code>trim(strip_tags($message, '&lt;a&gt;'))</code> and <code>trim($message)</code> you will want to enclose those with <code>quoted_printable_encode(trim(...))</code>.</p> <blockquote> <ul> <li>Should I use <code>mb_send_mail()</code> or <code>mail()</code> is enough?</li> </ul> </blockquote> <p>If you know you are <strong>not</strong> going to be handling Multibyte messages (Japanese, Korean, Chinese, etc.) then <code>mail()</code> should suffice.</p> <p>Now that I've answered your initial questions, let me tell you where some problems exist.</p> <ol> <li>You are specifying that the Character set of your Plain Text and Html content parts are UTF-8, however it doesn't appear as you are actually ensuring that they really are UTF-8 encoded.</li> <li>You are checking for <code>null</code> in <code>$to</code>, <code>$bcc</code>, <code>$attachments</code> before you further process them, however, you aren't doing anything when they may actually be <code>null</code>. So, if you happen to receive a <code>null</code> for <code>$to</code>, you don't process the variable, but you continue to send an email to <code>null</code>.</li> </ol> <p>As of right now, that's all I am going to go into but I am still going to highly recommend a pre-built solution as they have had lots of users/time to work out bugs.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload