UNPKG

mailcomposer

Version:

Compose E-Mail messages

1,908 lines (1,117 loc) 53.8 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="generator" content="JsDoc Toolkit" /> <title>MailComposer | JsDoc Reference</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /> <meta name="mobileoptimized" content="0" /> <link rel="stylesheet" href="../css/all.css" media="all" /> <link rel="stylesheet" href="../css/handheld.css" media="only screen and (max-width: 660px)" /> <link rel="stylesheet" href="../css/handheld.css" media="handheld" /> <link rel="stylesheet" href="../css/screen.css" media="screen and (min-width: 661px)" /> <script src="../javascript/all.js"></script> <!--[if lt IE 9]> <script src="../javascript/html5.js"></script> <![endif]--> </head> <body> <div class="index"> <div class="menu"> <div class="indexLinks"> <a href="../index.html">Classes</a> <a href="../files.html">Files</a> </div> <h2 class="heading1">Classes</h2> <input type="text" name="classFilter" class="classFilter" id="ClassFilter" placeholder="Filter"></input> <nav> <ul class="classList" id="ClassList"> <li><a href="../symbols/_global_.html">_global_</a></li> <li><a href="../symbols/MailComposer.html">MailComposer</a></li> </ul> </nav> </div> <div class="fineprint" style="clear:both"> <footer> Documentation generator: <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0<br /> Template: <a href="http://www.thebrightlines.com/2010/05/06/new-template-for-jsdoctoolkit-codeview/" target="_blank">Codeview</a> 1.2<br /> Generated on: <time datetime='2012-1-1' pubdate>2012-1-1 12:10</time> </footer> </div> </div> <div class="index indexStatic"></div> <div class="content"> <div class="innerContent"> <article> <header> <h1 class="classTitle"> Class <span>MailComposer</span> </h1> <div class="intro"> <p class="description summary"> </p> <ul class="summary"> <li>Defined in: <a href="../symbols/src/mailcomposer_lib_mailcomposer.js.html">mailcomposer.js</a></li> </ul> </div> </header> <section> <div class="props"> <table class="summaryTable" cellspacing="0" summary="A summary of the constructor documented in the class MailComposer."> <caption class="sectionTitle">Class Summary</caption> <thead> <tr> <th scope="col">Constructor Attributes</th> <th scope="col">Constructor Name and Description</th> </tr> </thead> <tbody> <tr> <td class="attributes">&nbsp;</td> <td class="nameDescription" > <div class="fixedFont"> <b><a href="../symbols/MailComposer.html#constructor">MailComposer</a></b>(options) </div> <div class="description"><p>Costructs a MailComposer object.</div> </td> </tr> </tbody> </table> </div> </section> <section> <nav> <div class="props"> <table class="summaryTable" cellspacing="0" summary="A summary of the fields documented in the class MailComposer."> <caption class="sectionTitle">Field Summary</caption> <thead> <tr> <th scope="col">Field Attributes</th> <th scope="col">Field Name and Description</th> </tr> </thead> <tbody> <tr> <td class="attributes">&lt;private&gt; &nbsp;</td> <td class="nameDescription"> <div class="fixedFont"> <b><a href="../symbols/MailComposer.html#_attachments">_attachments</a></b> </div> <div class="description"><p>Contains a list of attachments</p></div> </td> </tr> <tr> <td class="attributes">&lt;private&gt; &nbsp;</td> <td class="nameDescription"> <div class="fixedFont"> <b><a href="../symbols/MailComposer.html#_envelope">_envelope</a></b> </div> <div class="description"><p>Contains e-mail addresses for the SMTP</p></div> </td> </tr> <tr> <td class="attributes">&lt;private&gt; &nbsp;</td> <td class="nameDescription"> <div class="fixedFont"> <b><a href="../symbols/MailComposer.html#_gencounter">_gencounter</a></b> </div> <div class="description"><p>Counter for generating unique mime boundaries etc.</div> </td> </tr> <tr> <td class="attributes">&lt;private&gt; &nbsp;</td> <td class="nameDescription"> <div class="fixedFont"> <b><a href="../symbols/MailComposer.html#_headers">_headers</a></b> </div> <div class="description"><p>Contains all header values</p></div> </td> </tr> <tr> <td class="attributes">&lt;private&gt; &nbsp;</td> <td class="nameDescription"> <div class="fixedFont"> <b><a href="../symbols/MailComposer.html#_message">_message</a></b> </div> <div class="description"><p>Contains message related values</p></div> </td> </tr> </tbody> </table> </div> </nav> </section> <!-- #### METHODS SUMMARY --> <section> <div class="props"> <h2 class="sectionTitle">Method Summary</h2> <nav> <table class="summaryTable" id="MethodsList" cellspacing="0" summary="A summary of the methods documented in the class MailComposer."> <thead> <tr> <th scope="col">Method Attributes</th> <th scope="col">Method Name and Description</th> </tr> </thead> <tbody> <tr class='item0' > <td class="attributes">&lt;private&gt; &nbsp;</td> <td class="nameDescription"> <div class="fixedFont"><b><a href="../symbols/MailComposer.html#_buildMessageHeaders">_buildMessageHeaders</a></b>() </div> <div class="description"><p>Uses data from the <code>this._message</code> object to build headers</p></div> </td> </tr> <tr class='item1' > <td class="attributes">&lt;private&gt; &nbsp;</td> <td class="nameDescription"> <div class="fixedFont"><b><a href="../symbols/MailComposer.html#_composeBody">_composeBody</a></b>() </div> <div class="description"><p>Composes the e-mail body based on the previously generated mime tree</p> <p>Assumes that the linebreak separating headers and contents is already sent</p> <p>Emits 'data' events</p></div> </td> </tr> <tr class='item2' > <td class="attributes">&lt;private&gt; &nbsp;</td> <td class="nameDescription"> <div class="fixedFont"><b><a href="../symbols/MailComposer.html#_composeEnvelope">_composeEnvelope</a></b>() </div> <div class="description"><p>Composes and emits an envelope from the <code>this._envelope</code> object.</div> </td> </tr> <tr class='item3' > <td class="attributes">&lt;private&gt; &nbsp;</td> <td class="nameDescription"> <div class="fixedFont"><b><a href="../symbols/MailComposer.html#_composeHeader">_composeHeader</a></b>() </div> <div class="description"><p>Composes a header for the message and emits it with a <code>'data'</code> event</p> <p>Also checks and build a structure for the message (is it a multipart message and does it need a boundary etc.</div> </td> </tr> <tr class='item4' > <td class="attributes">&lt;private&gt; &nbsp;</td> <td class="nameDescription"> <div class="fixedFont"><b><a href="../symbols/MailComposer.html#_composeMessage">_composeMessage</a></b>() </div> <div class="description"><p>Generate an e-mail from the described info</p></div> </td> </tr> <tr class='item5' > <td class="attributes">&lt;private&gt; &nbsp;</td> <td class="nameDescription"> <div class="fixedFont"><b><a href="../symbols/MailComposer.html#_convertAddresses">_convertAddresses</a></b>(value) </div> <div class="description"><p>Handles a list of parsed e-mail addresses, checks encoding etc.</div> </td> </tr> <tr class='item6' > <td class="attributes">&lt;private&gt; &nbsp;</td> <td class="nameDescription"> <div class="fixedFont"><b><a href="../symbols/MailComposer.html#_createAttachmentComponent">_createAttachmentComponent</a></b>(attachment) </div> <div class="description"><p>Creates a mime tree node for a text component (plaintext, HTML)</p></div> </td> </tr> <tr class='item7' > <td class="attributes">&lt;private&gt; &nbsp;</td> <td class="nameDescription"> <div class="fixedFont"><b><a href="../symbols/MailComposer.html#_createMimeNode">_createMimeNode</a></b>() </div> <div class="description"><p>Creates an empty mime tree node</p></div> </td> </tr> <tr class='item8' > <td class="attributes">&lt;private&gt; &nbsp;</td> <td class="nameDescription"> <div class="fixedFont"><b><a href="../symbols/MailComposer.html#_createTextComponent">_createTextComponent</a></b>(text, contentType) </div> <div class="description"><p>Creates a mime tree node for a text component (plaintext, HTML)</p></div> </td> </tr> <tr class='item9' > <td class="attributes">&lt;private&gt; &nbsp;</td> <td class="nameDescription"> <div class="fixedFont"><b><a href="../symbols/MailComposer.html#_emitDataElement">_emitDataElement</a></b>(element, callback) </div> <div class="description"><p>Emits a data event for a text or html body and attachments.</div> </td> </tr> <tr class='item10' > <td class="attributes">&lt;private&gt; &nbsp;</td> <td class="nameDescription"> <div class="fixedFont"><b><a href="../symbols/MailComposer.html#_encodeMimeWord">_encodeMimeWord</a></b>(str, encoding, maxlen) </div> <div class="description"><p>Converts a string to mime word format.</div> </td> </tr> <tr class='item11' > <td class="attributes">&lt;private&gt; &nbsp;</td> <td class="nameDescription"> <div class="fixedFont"><b><a href="../symbols/MailComposer.html#_flattenMimeTree">_flattenMimeTree</a></b>() </div> <div class="description"><p>Converts a structured mimetree into an one dimensional array of components.</div> </td> </tr> <tr class='item12' > <td class="attributes">&lt;private&gt; &nbsp;</td> <td class="nameDescription"> <div class="fixedFont"><b><a href="../symbols/MailComposer.html#_generateBodyStructure">_generateBodyStructure</a></b>() </div> <div class="description"><p>Generates the structure (mime tree) of the body.</div> </td> </tr> <tr class='item13' > <td class="attributes">&lt;private&gt; &nbsp;</td> <td class="nameDescription"> <div class="fixedFont"><b><a href="../symbols/MailComposer.html#_generateBoundary">_generateBoundary</a></b>() </div> <div class="description"><p>Generates a boundary for multipart bodies</p></div> </td> </tr> <tr class='item14' > <td class="attributes">&lt;private&gt; &nbsp;</td> <td class="nameDescription"> <div class="fixedFont"><b><a href="../symbols/MailComposer.html#_getHeader">_getHeader</a></b>(key) </div> <div class="description"><p>Gets a header field</p></div> </td> </tr> <tr class='item15' > <td class="attributes">&lt;private&gt; &nbsp;</td> <td class="nameDescription"> <div class="fixedFont"><b><a href="../symbols/MailComposer.html#_getMimeType">_getMimeType</a></b>(filename) </div> <div class="description"><p>Resolves a mime type for a filename</p></div> </td> </tr> <tr class='item16' > <td class="attributes">&lt;private&gt; &nbsp;</td> <td class="nameDescription"> <div class="fixedFont"><b><a href="../symbols/MailComposer.html#_handleValue">_handleValue</a></b>(key, value) </div> <div class="description"><p>Handles a message object value, converts addresses etc.</div> </td> </tr> <tr class='item17' > <td class="attributes">&lt;private&gt; &nbsp;</td> <td class="nameDescription"> <div class="fixedFont"><b><a href="../symbols/MailComposer.html#_hasUTFChars">_hasUTFChars</a></b>(str) </div> <div class="description"><p>Tests if a string has high bit (UTF-8) symbols</p></div> </td> </tr> <tr class='item18' > <td class="attributes">&lt;private&gt; &nbsp;</td> <td class="nameDescription"> <div class="fixedFont"><b><a href="../symbols/MailComposer.html#_init">_init</a></b>() </div> <div class="description"><p>Resets and initializes MailComposer</p></div> </td> </tr> <tr class='item19' > <td class="attributes">&lt;private&gt; &nbsp;</td> <td class="nameDescription"> <div class="fixedFont"><b><a href="../symbols/MailComposer.html#_normalizeKey">_normalizeKey</a></b>(key) </div> <div class="description"><p>Normalizes a key name by cpitalizing first chars of words</p> <p><code>x-mailer</code> will become <code>X-Mailer</code></p> <p>Needed to avoid duplicate header keys</p></div> </td> </tr> <tr class='item20' > <td class="attributes">&lt;private&gt; &nbsp;</td> <td class="nameDescription"> <div class="fixedFont"><b><a href="../symbols/MailComposer.html#_serveFile">_serveFile</a></b>(filePath, callback) </div> <div class="description"><p>Pipes a file to the e-mail stream</p> <p>This function opens a file and starts sending 76 bytes long base64 encoded lines.</div> </td> </tr> <tr class='item21' > <td class="attributes">&nbsp;</td> <td class="nameDescription"> <div class="fixedFont"><b><a href="../symbols/MailComposer.html#addAttachment">addAttachment</a></b>(attachment) </div> <div class="description"><p>Adds an attachment to the list</p> <p>Following options are allowed:</p> <ul> <li><b>fileName</b> - filename for the attachment</li> <li><b>contentType</b> - content type for the attachmetn (default will be derived from the filename)</li> <li><b>cid</b> - Content ID value for inline images</li> <li><b>contents</b> - String or Buffer attachment contents</li> <li><b>filePath</b> - Path to a file for streaming</li> </ul> <p>One of <code>contents</code> or <code>filePath</code> must be specified, otherwise the attachment is not included</p></div> </td> </tr> <tr class='item22' > <td class="attributes">&nbsp;</td> <td class="nameDescription"> <div class="fixedFont"><b><a href="../symbols/MailComposer.html#addHeader">addHeader</a></b>(key, value) </div> <div class="description"><p>Adds a header field to the headers object</p></div> </td> </tr> <tr class='item23' > <td class="attributes">&nbsp;</td> <td class="nameDescription"> <div class="fixedFont"><b><a href="../symbols/MailComposer.html#compileHeaders">compileHeaders</a></b>(headers) </div> <div class="description"><p>Compiles headers object into an array of header lines.</div> </td> </tr> <tr class='item24' > <td class="attributes">&nbsp;</td> <td class="nameDescription"> <div class="fixedFont"><b><a href="../symbols/MailComposer.html#setMessageOption">setMessageOption</a></b>(options) </div> <div class="description"><p>Resets and initializes MailComposer</p> <p>Setting an option overwrites an earlier setup for the same keys</p> <p>Possible options:</p> <ul> <li><b>from</b> - The e-mail address of the sender.</div> </td> </tr> <tr class='item25' > <td class="attributes">&nbsp;</td> <td class="nameDescription"> <div class="fixedFont"><b><a href="../symbols/MailComposer.html#streamMessage">streamMessage</a></b>() </div> <div class="description"><p>Starts streaming the message</p></div> </td> </tr> </tbody> </table> </nav> </div> </section> <!-- #### EVENTS SUMMARY --> <!-- #### CONSTRUCTOR DETAILS --> <section> <div class="details props"> <div class="innerProps"> <h2 class="sectionTitle" id="constructor"> Class Detail </h2> <div class="fixedFont"> <b>MailComposer</b>(options) </div> <div class="description"> <p>Costructs a MailComposer object. This is a Stream instance so you could pipe the output to a file or send it to network.</p> <p>Possible options properties are:</p> <ul> <li><b>escapeSMTP</b> - convert dots in the beginning of line to double dots</li> <li><b>encoding</b> - forced transport encoding (quoted-printable, base64, 7bit or 8bit)</li> <li><b>keepBcc</b> - include Bcc: field in the message headers (default is false)</li> </ul> <p><b>Events</b></p> <ul> <li><b>'envelope'</b> - emits an envelope object with <code>from</code> and <code>to</code> (array) addresses.</li> <li><b>'data'</b> - emits a chunk of data</li> <li><b>'end'</b> - composing the message has ended</li> </ul> </div> <dl class="detailList params"> <dt class="heading">Parameters:</dt> <dt> <span class="light fixedFont">{Object}</span> <b>options</b> <i>Optional</i> </dt> <dd>Optional options object</dd> </dl> </div> </div> </section> <!-- #### FIELD DETAILS --> <section> <div class="details props"> <div class="innerProps"> <h2 class="sectionTitle"> Field Detail </h2> <div class="fixedFont heading" id="_attachments"> <span class='lighter'> &lt;private&gt; </span> <b>_attachments</b> </div> <div class="description"> <p>Contains a list of attachments</p> </div> <div class="hr"></div> <div class="fixedFont heading" id="_envelope"> <span class='lighter'> &lt;private&gt; </span> <b>_envelope</b> </div> <div class="description"> <p>Contains e-mail addresses for the SMTP</p> </div> <div class="hr"></div> <div class="fixedFont heading" id="_gencounter"> <span class='lighter'> &lt;private&gt; </span> <b>_gencounter</b> </div> <div class="description"> <p>Counter for generating unique mime boundaries etc.</p> </div> <div class="hr"></div> <div class="fixedFont heading" id="_headers"> <span class='lighter'> &lt;private&gt; </span> <b>_headers</b> </div> <div class="description"> <p>Contains all header values</p> </div> <div class="hr"></div> <div class="fixedFont heading" id="_message"> <span class='lighter'> &lt;private&gt; </span> <b>_message</b> </div> <div class="description"> <p>Contains message related values</p> </div> </div> </div> </section> <!-- #### METHOD DETAILS --> <section> <div class="details props"> <div class="innerProps"> <h2 class="sectionTitle"> Method Detail </h2> <ul class="methodDetail" id="MethodDetail"> <li class='item0' > <div class="fixedFont heading" id="_buildMessageHeaders"> <span class='lighter'> &lt;private&gt; </span> <b>_buildMessageHeaders</b>() </div> <div class="description"> <p>Uses data from the <code>this._message</code> object to build headers</p> </div> <div class="hr"></div> </li> <li class='item1' > <div class="fixedFont heading" id="_composeBody"> <span class='lighter'> &lt;private&gt; </span> <b>_composeBody</b>() </div> <div class="description"> <p>Composes the e-mail body based on the previously generated mime tree</p> <p>Assumes that the linebreak separating headers and contents is already sent</p> <p>Emits 'data' events</p> </div> <div class="hr"></div> </li> <li class='item2' > <div class="fixedFont heading" id="_composeEnvelope"> <span class='lighter'> &lt;private&gt; </span> <b>_composeEnvelope</b>() </div> <div class="description"> <p>Composes and emits an envelope from the <code>this._envelope</code> object. Needed for the SMTP client</p> <p>Emitted envelope is int hte following structure:</p> <pre> { to: "address", from: ["list", "of", "addresses"] } </pre> <p>Both properties (<code>from</code> and <code>to</code>) are optional and may not exist</p> </div> <div class="hr"></div> </li> <li class='item3' > <div class="fixedFont heading" id="_composeHeader"> <span class='lighter'> &lt;private&gt; </span> <b>_composeHeader</b>() </div> <div class="description"> <p>Composes a header for the message and emits it with a <code>'data'</code> event</p> <p>Also checks and build a structure for the message (is it a multipart message and does it need a boundary etc.)</p> <p>By default the message is not a multipart. If the message containes both plaintext and html contents, an alternative block is used. it it containes attachments, a mixed block is used. If both alternative and mixed exist, then alternative resides inside mixed.</p> </div> <div class="hr"></div> </li> <li class='item4' > <div class="fixedFont heading" id="_composeMessage"> <span class='lighter'> &lt;private&gt; </span> <b>_composeMessage</b>() </div> <div class="description"> <p>Generate an e-mail from the described info</p> </div> <div class="hr"></div> </li> <li class='item5' > <div class="fixedFont heading" id="_convertAddresses"> <span class='lighter'> &lt;private&gt; </span> <span class="light">{String}</span> <b>_convertAddresses</b>(value) </div> <div class="description"> <p>Handles a list of parsed e-mail addresses, checks encoding etc.</p> </div> <dl class="detailList params"> <dt class="heading">Parameters:</dt> <dt> <span class="light fixedFont">{Array}</span> <b>value</b> </dt> <dd>A list or single e-mail address <code>{address:'...', name:'...'}</code></dd> </dl> <dl class="detailList nomargin"> <dt class="heading">Returns:</dt> <dd><span class="light fixedFont">{String}</span> Comma separated and encoded list of addresses</dd> </dl> <div class="hr"></div> </li> <li class='item6' > <div class="fixedFont heading" id="_createAttachmentComponent"> <span class='lighter'> &lt;private&gt; </span> <span class="light">{Object}</span> <b>_createAttachmentComponent</b>(attachment) </div> <div class="description"> <p>Creates a mime tree node for a text component (plaintext, HTML)</p> </div> <dl class="detailList params"> <dt class="heading">Parameters:</dt> <dt> <span class="light fixedFont">{Object}</span> <b>attachment</b> </dt> <dd>Attachment info for the component</dd> </dl> <dl class="detailList nomargin"> <dt class="heading">Returns:</dt> <dd><span class="light fixedFont">{Object}</span> Mime tree node</dd> </dl> <div class="hr"></div> </li> <li class='item7' > <div class="fixedFont heading" id="_createMimeNode"> <span class='lighter'> &lt;private&gt; </span> <span class="light">{Object}</span> <b>_createMimeNode</b>() </div> <div class="description"> <p>Creates an empty mime tree node</p> </div> <dl class="detailList nomargin"> <dt class="heading">Returns:</dt> <dd><span class="light fixedFont">{Object}</span> Mime tree node</dd> </dl> <div class="hr"></div> </li> <li class='item8' > <div class="fixedFont heading" id="_createTextComponent"> <span class='lighter'> &lt;private&gt; </span> <span class="light">{Object}</span> <b>_createTextComponent</b>(text, contentType) </div> <div class="description"> <p>Creates a mime tree node for a text component (plaintext, HTML)</p> </div> <dl class="detailList params"> <dt class="heading">Parameters:</dt> <dt> <span class="light fixedFont">{String}</span> <b>text</b> </dt> <dd>Text contents for the component</dd> <dt> <span class="light fixedFont">{String}</span> <b>contentType</b> <i>Optional, Default: "text/plain"</i> </dt> <dd>Content type for the text component</dd> </dl> <dl class="detailList nomargin"> <dt class="heading">Returns:</dt> <dd><span class="light fixedFont">{Object}</span> Mime tree node</dd> </dl> <div class="hr"></div> </li> <li class='item9' > <div class="fixedFont heading" id="_emitDataElement"> <span class='lighter'> &lt;private&gt; </span> <b>_emitDataElement</b>(element, callback) </div> <div class="description"> <p>Emits a data event for a text or html body and attachments. If it is a file, stream it</p> <p>If <code>this.options.escapeSMTP</code> is true, replace dots in the beginning of a line with double dots - only valid for QP encoding</p> </div> <dl class="detailList params"> <dt class="heading">Parameters:</dt> <dt> <span class="light fixedFont">{Object}</span> <b>element</b> </dt> <dd>Data element descriptor</dd> <dt> <span class="light fixedFont">{Function}</span> <b>callback</b> </dt> <dd>Callback function to run when completed</dd> </dl> <div class="hr"></div> </li> <li class='item10' > <div class="fixedFont heading" id="_encodeMimeWord"> <span class='lighter'> &lt;private&gt; </span> <span class="light">{String}</span> <b>_encodeMimeWord</b>(str, encoding, maxlen) </div> <div class="description"> <p>Converts a string to mime word format. If the length is longer than <code>maxlen</code>, split it</p> <p>If the string doesn't have any unicode characters return the original string instead</p> </div> <dl class="detailList params"> <dt class="heading">Parameters:</dt> <dt> <span class="light fixedFont">{String}</span> <b>str</b> </dt> <dd>String to be encoded</dd> <dt> <span class="light fixedFont">{String}</span> <b>encoding</b> </dt> <dd>Either Q for Quoted-Printable or B for Base64</dd> <dt> <span class="light fixedFont">{Number}</span> <b>maxlen</b> <i>Optional</i> </dt> <dd>Optional length of the resulting string, whitespace will be inserted if needed</dd> </dl> <dl class="detailList nomargin"> <dt class="heading">Returns:</dt> <dd><span class="light fixedFont">{String}</span> Mime-word encoded string (if needed)</dd> </dl> <div class="hr"></div> </li> <li class='item11' > <div class="fixedFont heading" id="_flattenMimeTree"> <span class='lighter'> &lt;private&gt; </span> <b>_flattenMimeTree</b>() </div> <div class="description"> <p>Converts a structured mimetree into an one dimensional array of components. This includes headers and multipart boundaries as strings, textual and attachment contents are.</p> </div> <div class="hr"></div> </li> <li class='item12' > <div class="fixedFont heading" id="_generateBodyStructure"> <span class='lighter'> &lt;private&gt; </span> <b>_generateBodyStructure</b>() </div> <div class="description"> <p>Generates the structure (mime tree) of the body. This sets up multipart structure, individual part headers, boundaries etc.</p> <p>The headers of the root element will be appended to the message headers</p> </div> <div class="hr"></div> </li> <li class='item13' > <div class="fixedFont heading" id="_generateBoundary"> <span class='lighter'> &lt;private&gt; </span> <span class="light">{String}</span> <b>_generateBoundary</b>() </div> <div class="description"> <p>Generates a boundary for multipart bodies</p> </div> <dl class="detailList nomargin"> <dt class="heading">Returns:</dt> <dd><span class="light fixedFont">{String}</span> Boundary String</dd> </dl> <div class="hr"></div> </li> <li class='item14' > <div class="fixedFont heading" id="_getHeader"> <span class='lighter'> &lt;private&gt; </span> <span class="light">{String|Array}</span> <b>_getHeader</b>(key) </div> <div class="description"> <p>Gets a header field</p> </div> <dl class="detailList params"> <dt class="heading">Parameters:</dt> <dt> <span class="light fixedFont">{String}</span> <b>key</b> </dt> <dd>Key name</dd> </dl> <dl class="detailList nomargin"> <dt class="heading">Returns:</dt> <dd><span class="light fixedFont">{String|Array}</span> Header field - if several values, then it's an array</dd> </dl> <div class="hr"></div> </li> <li class='item15' > <div class="fixedFont heading" id="_getMimeType"> <span class='lighter'> &lt;private&gt; </span> <span class="light">{String}</span> <b>_getMimeType</b>(filename) </div> <div class="description"> <p>Resolves a mime type for a filename</p> </div> <dl class="detailList params"> <dt class="heading">Parameters:</dt> <dt> <span class="light fixedFont">{String}</span> <b>filename</b> </dt> <dd>Filename to check</dd> </dl> <dl class="detailList nomargin"> <dt class="heading">Returns:</dt> <dd><span class="light fixedFont">{String}</span> Corresponding mime type</dd> </dl> <div class="hr"></div> </li> <li class='item16' > <div class="fixedFont heading" id="_handleValue"> <span class='lighter'> &lt;private&gt; </span> <span class="light">{String}</span> <b>_handleValue</b>(key, value) </div> <div class="description"> <p>Handles a message object value, converts addresses etc.</p> </div> <dl class="detailList params"> <dt class="heading">Parameters:</dt> <dt> <span class="light fixedFont">{String}</span> <b>key</b> </dt> <dd>Message options key</dd> <dt> <span class="light fixedFont">{String}</span> <b>value</b> </dt> <dd>Message options value</dd> </dl> <dl class="detailList nomargin"> <dt class="heading">Returns:</dt> <dd><span class="light fixedFont">{String}</span> converted value</dd> </dl> <div class="hr"></div> </li> <li class='item17' > <div class="fixedFont heading" id="_hasUTFChars"> <span class='lighter'> &lt;private&gt; </span> <span class="light">{Boolean}</span> <b>_hasUTFChars</b>(str) </div> <div class="description"> <p>Tests if a string has high bit (UTF-8) symbols</p> </div> <dl class="detailList params"> <dt class="heading">Parameters:</dt> <dt> <span class="light fixedFont">{String}</span> <b>str</b> </dt> <dd>String to be tested for high bit symbols</dd> </dl> <dl class="detailList nomargin"> <dt class="heading">Returns:</dt> <dd><span class="light fixedFont">{Boolean}</span> true if high bit symbols were found</dd> </dl> <div class="hr"></div> </li> <li class='item18' > <div class="fixedFont heading" id="_init"> <span class='lighter'> &lt;private&gt; </span> <b>_init</b>() </div> <div class="description"> <p>Resets and initializes MailComposer</p> </div> <div class="hr"></div> </li> <li class='item19' > <div class="fixedFont heading" id="_normalizeKey"> <span class='lighter'> &lt;private&gt; </span> <span class="light">{String}</span> <b>_normalizeKey</b>(key) </div> <div class="description"> <p>Normalizes a key name by cpitalizing first chars of words</p> <p><code>x-mailer</code> will become <code>X-Mailer</code></p> <p>Needed to avoid duplicate header keys</p> </div> <dl class="detailList params"> <dt class="heading">Parameters:</dt> <dt> <span class="light fixedFont">{String}</span> <b>key</b> </dt> <dd>Key name</dd> </dl> <dl class="detailList nomargin"> <dt class="heading">Returns:</dt> <dd><span class="light fixedFont">{String}</span> First chars uppercased</dd> </dl> <div class="hr"></div> </li> <li class='item20' > <div class="fixedFont heading" id="_serveFile"> <span class='lighter'> &lt;private&gt; </span> <b>_serveFile</b>(filePath, callback) </div> <div class="description"> <p>Pipes a file to the e-mail stream</p> <p>This function opens a file and starts sending 76 bytes long base64 encoded lines. To achieve this, the incoming stream is divded into chunks of 57 bytes (57/3*4=76) to achieve exactly 76 byte long base64</p> </div> <dl class="detailList params"> <dt class="heading">Parameters:</dt> <dt> <span class="light fixedFont">{String}</span> <b>filePath</b> </dt> <dd>Path to the file</dd> <dt> <span class="light fixedFont">{Function}</span> <b>callback</b> </dt> <dd>Callback function to run after completion</dd> </dl> <div class="hr"></div> </li> <li class='item21' > <div class="fixedFont heading" id="addAttachment"> <span class='lighter'> </span> <b>addAttachment</b>(attachment) </div> <div class="description"> <p>Adds an attachment to the list</p> <p>Following options are allowed:</p> <ul> <li><b>fileName</b> - filename for the attachment</li> <li><b>contentType</b> - content type for the attachmetn (default will be derived from the filename)</li> <li><b>cid</b> - Content ID value for inline images</li> <li><b>contents</b> - String or Buffer attachment contents</li> <li><b>filePath</b> - Path to a file for streaming</li> </ul> <p>One of <code>contents</code> or <code>filePath</code> must be specified, otherwise the attachment is not included</p> </div> <dl class="detailList params"> <dt class="heading">Parameters:</dt> <dt> <span class="light fixedFont">{Object}</span> <b>attachment</b> </dt> <dd>Attachment info</dd> </dl> <div class="hr"></div> </li> <li class='item22' > <div class="fixedFont heading" id="addHeader"> <span class='lighter'> </span> <b>addHeader</b>(key, value) </div> <div class="description"> <p>Adds a header field to the headers object</p> </div> <dl class="detailList params"> <dt class="heading">Parameters:</dt> <dt> <span class="light fixedFont">{String}</span> <b>key</b> </dt> <dd>Key name</dd> <dt> <span class="light fixedFont">{String}</span> <b>value</b> </dt> <dd>Header value</dd> </dl> <div class="hr"></div> </li> <li class='item23' > <div class="fixedFont heading" id="compileHeaders"> <span class='lighter'> </span> <span class="light">{Array}</span> <b>compileHeaders</b>(headers) </div> <div class="description"> <p>Compiles headers object into an array of head