Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Create gh-pages branch via GitHub

  • Loading branch information...
commit 397ada84fb6a29f5ed97456711522e4c797b9b97 1 parent 1ed5b77
Andris Reinman authored
BIN  images/background.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  images/body-background.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  images/bullet.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  images/octocat-logo.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
610 index.html
View
@@ -1,37 +1,45 @@
-<!DOCTYPE html>
+<!doctype html>
<html>
-
<head>
- <meta charset='utf-8'>
+ <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
- <meta name="description" content="Nodemailer : Send e-mails from Node.js – easy as cake!">
-
- <link rel="stylesheet" type="text/css" media="screen" href="stylesheets/stylesheet.css">
+ <title>Nodemailer by andris9</title>
+ <link rel="stylesheet" href="stylesheets/styles.css">
+ <link rel="stylesheet" href="stylesheets/pygment_trac.css">
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
+ <script src="javascripts/main.js"></script>
+ <!--[if lt IE 9]>
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
+ <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
- <title>Nodemailer</title>
</head>
-
<body>
- <!-- HEADER -->
- <div id="header_wrap" class="outer">
- <header class="inner">
- <a id="forkme_banner" href="https://github.com/andris9/Nodemailer">View on GitHub</a>
-
- <h1 id="project_title">Nodemailer</h1>
- <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
-
- <section id="downloads">
- <a class="zip_download_link" href="https://github.com/andris9/Nodemailer/zipball/master">Download this project as a .zip file</a>
- <a class="tar_download_link" href="https://github.com/andris9/Nodemailer/tarball/master">Download this project as a tar.gz file</a>
- </section>
- </header>
- </div>
-
- <!-- MAIN CONTENT -->
- <div id="main_content_wrap" class="outer">
- <section id="main_content" class="inner">
- <p><img src="https://raw2.github.com/andris9/Nodemailer/master/assets/nm_logo_200x136.png" alt="Nodemailer"></p>
+ <header>
+ <h1>Nodemailer</h1>
+ <p>Send e-mails from Node.js – easy as cake!</p>
+ </header>
+
+ <div id="banner">
+ <span id="logo"></span>
+
+ <a href="https://github.com/andris9/Nodemailer" class="button fork"><strong>View On GitHub</strong></a>
+ <div class="downloads">
+ <span>Downloads:</span>
+ <ul>
+ <li><a href="https://github.com/andris9/Nodemailer/zipball/master" class="button">ZIP</a></li>
+ <li><a href="https://github.com/andris9/Nodemailer/tarball/master" class="button">TAR</a></li>
+ </ul>
+ </div>
+ </div><!-- end banner -->
+
+ <div class="wrapper">
+ <nav>
+ <ul></ul>
+ </nav>
+ <section>
+ <p><img src="https://raw.githubusercontent.com/andris9/Nodemailer/master/assets/nm_logo_200x136.png" alt="Nodemailer"></p>
<p>Send e-mails from Node.js – easy as cake!</p>
@@ -39,20 +47,20 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
<a href="http://badge.fury.io/js/nodemailer"><img src="https://badge.fury.io/js/nodemailer.svg" alt="NPM version" height="18"></a></p>
<h2>
-<a name="upgrade-warning" class="anchor" href="#upgrade-warning"><span class="octicon octicon-link"></span></a>Upgrade warning</h2>
+<a id="upgrade-warning" class="anchor" href="#upgrade-warning" aria-hidden="true"><span class="octicon octicon-link"></span></a>Upgrade warning</h2>
<p>Do not upgrade Nodemailer from 0.7 or lower to 1.0 as there are breaking changes. You can continue to use the 0.7 branch as long as you like. See the documentation for 0.7 <a href="https://github.com/andris9/Nodemailer/blob/0.7/README.md">here</a>.</p>
<h3>
-<a name="migration-guide" class="anchor" href="#migration-guide"><span class="octicon octicon-link"></span></a>Migration guide</h3>
+<a id="migration-guide" class="anchor" href="#migration-guide" aria-hidden="true"><span class="octicon octicon-link"></span></a>Migration guide</h3>
<p>See the migration guide from 0.7 to 1.0 <a href="http://www.andrisreinman.com/nodemailer-v1-0/#migrationguide">in the 1.0 release blog post</a>.</p>
<h2>
-<a name="notes-and-information" class="anchor" href="#notes-and-information"><span class="octicon octicon-link"></span></a>Notes and information</h2>
+<a id="notes-and-information" class="anchor" href="#notes-and-information" aria-hidden="true"><span class="octicon octicon-link"></span></a>Notes and information</h2>
<h3>
-<a name="nodemailer-supports" class="anchor" href="#nodemailer-supports"><span class="octicon octicon-link"></span></a>Nodemailer supports</h3>
+<a id="nodemailer-supports" class="anchor" href="#nodemailer-supports" aria-hidden="true"><span class="octicon octicon-link"></span></a>Nodemailer supports</h3>
<ul>
<li>
@@ -70,50 +78,51 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
<li>Different <strong>transport methods</strong>, either using built in transports or from external plugins</li>
<li>Custom <strong>Plugin support</strong> for manipulating messages (add DKIM signatures, use markdown content instead of HTML etc.)</li>
<li>Sane <strong>XOAUTH2</strong> login with automatic access token generation (and feedback about the updated tokens)</li>
-</ul><h3>
-<a name="support-nodemailer-development" class="anchor" href="#support-nodemailer-development"><span class="octicon octicon-link"></span></a>Support Nodemailer development</h3>
+</ul>
+
+<h3>
+<a id="support-nodemailer-development" class="anchor" href="#support-nodemailer-development" aria-hidden="true"><span class="octicon octicon-link"></span></a>Support Nodemailer development</h3>
<p><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=DB26KWR2BQX5W"><img src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" alt="Donate to author"></a></p>
<p>If you want to support with Bitcoins, then my wallet address is <code>15Z8ADxhssKUiwP3jbbqJwA21744KMCfTM</code></p>
<h2>
-<a name="tldr-usage-example" class="anchor" href="#tldr-usage-example"><span class="octicon octicon-link"></span></a>TL;DR Usage Example</h2>
+<a id="tldr-usage-example" class="anchor" href="#tldr-usage-example" aria-hidden="true"><span class="octicon octicon-link"></span></a>TL;DR Usage Example</h2>
<p>This is a complete example to send an e-mail with plaintext and HTML body</p>
-<div class="highlight highlight-javascript"><pre><span class="kd">var</span> <span class="nx">nodemailer</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">'nodemailer'</span><span class="p">);</span>
-
-<span class="c1">// create reusable transporter object using SMTP transport</span>
-<span class="kd">var</span> <span class="nx">transporter</span> <span class="o">=</span> <span class="nx">nodemailer</span><span class="p">.</span><span class="nx">createTransport</span><span class="p">({</span>
- <span class="nx">service</span><span class="o">:</span> <span class="s1">'Gmail'</span><span class="p">,</span>
- <span class="nx">auth</span><span class="o">:</span> <span class="p">{</span>
- <span class="nx">user</span><span class="o">:</span> <span class="s1">'gmail.user@gmail.com'</span><span class="p">,</span>
- <span class="nx">pass</span><span class="o">:</span> <span class="s1">'userpass'</span>
- <span class="p">}</span>
-<span class="p">});</span>
-
-<span class="c1">// NB! No need to recreate the transporter object. You can use</span>
-<span class="c1">// the same transporter object for all e-mails</span>
-
-<span class="c1">// setup e-mail data with unicode symbols</span>
-<span class="kd">var</span> <span class="nx">mailOptions</span> <span class="o">=</span> <span class="p">{</span>
- <span class="nx">from</span><span class="o">:</span> <span class="s1">'Fred Foo ✔ &lt;foo@blurdybloop.com&gt;'</span><span class="p">,</span> <span class="c1">// sender address</span>
- <span class="nx">to</span><span class="o">:</span> <span class="s1">'bar@blurdybloop.com, baz@blurdybloop.com'</span><span class="p">,</span> <span class="c1">// list of receivers</span>
- <span class="nx">subject</span><span class="o">:</span> <span class="s1">'Hello ✔'</span><span class="p">,</span> <span class="c1">// Subject line</span>
- <span class="nx">text</span><span class="o">:</span> <span class="s1">'Hello world ✔'</span><span class="p">,</span> <span class="c1">// plaintext body</span>
- <span class="nx">html</span><span class="o">:</span> <span class="s1">'&lt;b&gt;Hello world ✔&lt;/b&gt;'</span> <span class="c1">// html body</span>
-<span class="p">};</span>
-
-<span class="c1">// send mail with defined transport object</span>
-<span class="nx">transporter</span><span class="p">.</span><span class="nx">sendMail</span><span class="p">(</span><span class="nx">mailOptions</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">error</span><span class="p">,</span> <span class="nx">info</span><span class="p">){</span>
- <span class="k">if</span><span class="p">(</span><span class="nx">error</span><span class="p">){</span>
- <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">error</span><span class="p">);</span>
- <span class="p">}</span><span class="k">else</span><span class="p">{</span>
- <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">'Message sent: '</span> <span class="o">+</span> <span class="nx">info</span><span class="p">.</span><span class="nx">response</span><span class="p">);</span>
- <span class="p">}</span>
-<span class="p">});</span>
-</pre></div>
+<div class="highlight highlight-javascript"><pre><span class="pl-s">var</span> nodemailer <span class="pl-ko">=</span> <span class="pl-sf">require</span>(<span class="pl-s1"><span class="pl-pds">'</span>nodemailer<span class="pl-pds">'</span></span>);
+
+<span class="pl-c"><span class="pl-pdc">//</span> create reusable transporter object using SMTP transport</span>
+<span class="pl-s">var</span> transporter <span class="pl-ko">=</span> nodemailer.createTransport({
+ service<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>Gmail<span class="pl-pds">'</span></span>,
+ auth<span class="pl-ko">:</span> {
+ user<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>gmail.user@gmail.com<span class="pl-pds">'</span></span>,
+ pass<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>userpass<span class="pl-pds">'</span></span>
+ }
+});
+
+<span class="pl-c"><span class="pl-pdc">//</span> NB! No need to recreate the transporter object. You can use</span>
+<span class="pl-c"><span class="pl-pdc">//</span> the same transporter object for all e-mails</span>
+
+<span class="pl-c"><span class="pl-pdc">//</span> setup e-mail data with unicode symbols</span>
+<span class="pl-s">var</span> mailOptions <span class="pl-ko">=</span> {
+ from<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>Fred Foo ✔ &lt;foo@blurdybloop.com&gt;<span class="pl-pds">'</span></span>, <span class="pl-c"><span class="pl-pdc">//</span> sender address</span>
+ to<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>bar@blurdybloop.com, baz@blurdybloop.com<span class="pl-pds">'</span></span>, <span class="pl-c"><span class="pl-pdc">//</span> list of receivers</span>
+ subject<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>Hello ✔<span class="pl-pds">'</span></span>, <span class="pl-c"><span class="pl-pdc">//</span> Subject line</span>
+ text<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>Hello world ✔<span class="pl-pds">'</span></span>, <span class="pl-c"><span class="pl-pdc">//</span> plaintext body</span>
+ html<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>&lt;b&gt;Hello world ✔&lt;/b&gt;<span class="pl-pds">'</span></span> <span class="pl-c"><span class="pl-pdc">//</span> html body</span>
+};
+
+<span class="pl-c"><span class="pl-pdc">//</span> send mail with defined transport object</span>
+transporter.sendMail(mailOptions, <span class="pl-s">function</span>(<span class="pl-vpf">error</span>, <span class="pl-vpf">info</span>){
+ <span class="pl-k">if</span>(error){
+ console<span class="pl-sf">.log</span>(error);
+ }<span class="pl-k">else</span>{
+ console<span class="pl-sf">.log</span>(<span class="pl-s1"><span class="pl-pds">'</span>Message sent: <span class="pl-pds">'</span></span> <span class="pl-ko">+</span> info.response);
+ }
+});</pre></div>
<p>See <a href="https://github.com/andris9/nodemailer-smtp-transport#usage">nodemailer-smtp-transport</a> for SMTP configuration options and <a href="https://github.com/andris9/nodemailer-wellknown#supported-services">nodemailer-wellknown</a> for preconfigured service names (example uses 'gmail').</p>
@@ -122,22 +131,22 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
</blockquote>
<h2>
-<a name="goals-for-10" class="anchor" href="#goals-for-10"><span class="octicon octicon-link"></span></a>Goals for 1.0</h2>
+<a id="goals-for-10" class="anchor" href="#goals-for-10" aria-hidden="true"><span class="octicon octicon-link"></span></a>Goals for 1.0</h2>
<h3>
-<a name="1-move-optional-features-out-of-core" class="anchor" href="#1-move-optional-features-out-of-core"><span class="octicon octicon-link"></span></a>1. Move optional features out of core</h3>
+<a id="1-move-optional-features-out-of-core" class="anchor" href="#1-move-optional-features-out-of-core" aria-hidden="true"><span class="octicon octicon-link"></span></a>1. Move optional features out of core</h3>
<p>Nodemailer 0.x is quite large and includes a ton of stuff that is not needed for most users. Sometimes it causes problems, for example when
a feature that you do not even use requires some dependency to be installed that throws in your environment. If you only use SMTP to send e-mails you do not need the SES code and vice versa. The goal is achieved with a plugin system where you can install and load only these plugins that you actually require.</p>
<h3>
-<a name="2-gigabyte-attachments" class="anchor" href="#2-gigabyte-attachments"><span class="octicon octicon-link"></span></a>2. Gigabyte attachments</h3>
+<a id="2-gigabyte-attachments" class="anchor" href="#2-gigabyte-attachments" aria-hidden="true"><span class="octicon octicon-link"></span></a>2. Gigabyte attachments</h3>
<p>Version 1.0 is a total rewrite from the ground up and relying heavily on Streams2. This allows you to reliably
send messages with gigabyte attachments even through a slow network connection without CPU or memory penalties. You probably never need it but it makes using smaller attachments more reliable as well.</p>
<h2>
-<a name="setting-up" class="anchor" href="#setting-up"><span class="octicon octicon-link"></span></a>Setting up</h2>
+<a id="setting-up" class="anchor" href="#setting-up" aria-hidden="true"><span class="octicon octicon-link"></span></a>Setting up</h2>
<p>Install with npm</p>
@@ -146,8 +155,7 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
<p>To send e-mails you need a transporter object</p>
-<div class="highlight highlight-javascript"><pre><span class="kd">var</span> <span class="nx">transporter</span> <span class="o">=</span> <span class="nx">nodemailer</span><span class="p">.</span><span class="nx">createTransport</span><span class="p">(</span><span class="nx">transport</span><span class="p">)</span>
-</pre></div>
+<div class="highlight highlight-javascript"><pre><span class="pl-s">var</span> transporter <span class="pl-ko">=</span> nodemailer.createTransport(transport)</pre></div>
<p>Where</p>
@@ -156,52 +164,52 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
<strong>transporter</strong> is going to be an object that is able to send mail</li>
<li>
<strong>transport</strong> is a transport mechanism. If it is not set <a href="https://github.com/andris9/nodemailer-direct-transport">nodemailer-direct-transport</a> transport is used. If it is a regular object <a href="https://github.com/andris9/nodemailer-smtp-transport">nodemailer-smtp-transport</a> is used and the value is passed as SMTP configuration.</li>
-</ul><blockquote>
+</ul>
+
+<blockquote>
<p>You have to create the transporter object only once. If you already have a transporter object you can use it to send mail as much as you like.</p>
</blockquote>
<h3>
-<a name="examples" class="anchor" href="#examples"><span class="octicon octicon-link"></span></a>Examples</h3>
+<a id="examples" class="anchor" href="#examples" aria-hidden="true"><span class="octicon octicon-link"></span></a>Examples</h3>
<h4>
-<a name="use-direct-transport" class="anchor" href="#use-direct-transport"><span class="octicon octicon-link"></span></a>Use <em>direct</em> transport</h4>
+<a id="use-direct-transport" class="anchor" href="#use-direct-transport" aria-hidden="true"><span class="octicon octicon-link"></span></a>Use <em>direct</em> transport</h4>
<p>In this case all e-mails are sent directly to the recipients MX server (using port 25)</p>
-<div class="highlight highlight-javascript"><pre><span class="kd">var</span> <span class="nx">nodemailer</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">'nodemailer'</span><span class="p">);</span>
-<span class="kd">var</span> <span class="nx">transporter</span> <span class="o">=</span> <span class="nx">nodemailer</span><span class="p">.</span><span class="nx">createTransport</span><span class="p">();</span>
-<span class="nx">transporter</span><span class="p">.</span><span class="nx">sendMail</span><span class="p">({</span>
- <span class="nx">from</span><span class="o">:</span> <span class="s1">'sender@address'</span><span class="p">,</span>
- <span class="nx">to</span><span class="o">:</span> <span class="s1">'receiver@address'</span><span class="p">,</span>
- <span class="nx">subject</span><span class="o">:</span> <span class="s1">'hello'</span><span class="p">,</span>
- <span class="nx">text</span><span class="o">:</span> <span class="s1">'hello world!'</span>
-<span class="p">});</span>
-</pre></div>
+<div class="highlight highlight-javascript"><pre><span class="pl-s">var</span> nodemailer <span class="pl-ko">=</span> <span class="pl-sf">require</span>(<span class="pl-s1"><span class="pl-pds">'</span>nodemailer<span class="pl-pds">'</span></span>);
+<span class="pl-s">var</span> transporter <span class="pl-ko">=</span> nodemailer.createTransport();
+transporter.sendMail({
+ from<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>sender@address<span class="pl-pds">'</span></span>,
+ to<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>receiver@address<span class="pl-pds">'</span></span>,
+ subject<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>hello<span class="pl-pds">'</span></span>,
+ text<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>hello world!<span class="pl-pds">'</span></span>
+});</pre></div>
<blockquote>
<p>Using <em>direct</em> transport is not reliable as outgoing port 25 used is often blocked by default. Additionally mail sent from dynamic addresses is often flagged as spam. You should really consider using a SMTP provider.</p>
</blockquote>
<h4>
-<a name="use-the-default-smtp-transport" class="anchor" href="#use-the-default-smtp-transport"><span class="octicon octicon-link"></span></a>Use the default <em>SMTP</em> transport</h4>
+<a id="use-the-default-smtp-transport" class="anchor" href="#use-the-default-smtp-transport" aria-hidden="true"><span class="octicon octicon-link"></span></a>Use the default <em>SMTP</em> transport</h4>
<p>See SMTP <a href="https://github.com/andris9/nodemailer-smtp-transport#usage">configuration options here</a></p>
-<div class="highlight highlight-javascript"><pre><span class="kd">var</span> <span class="nx">nodemailer</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">'nodemailer'</span><span class="p">);</span>
-<span class="kd">var</span> <span class="nx">transporter</span> <span class="o">=</span> <span class="nx">nodemailer</span><span class="p">.</span><span class="nx">createTransport</span><span class="p">({</span>
- <span class="nx">service</span><span class="o">:</span> <span class="s1">'gmail'</span><span class="p">,</span>
- <span class="nx">auth</span><span class="o">:</span> <span class="p">{</span>
- <span class="nx">user</span><span class="o">:</span> <span class="s1">'sender@gmail.com'</span><span class="p">,</span>
- <span class="nx">pass</span><span class="o">:</span> <span class="s1">'password'</span>
- <span class="p">}</span>
-<span class="p">});</span>
-<span class="nx">transporter</span><span class="p">.</span><span class="nx">sendMail</span><span class="p">({</span>
- <span class="nx">from</span><span class="o">:</span> <span class="s1">'sender@address'</span><span class="p">,</span>
- <span class="nx">to</span><span class="o">:</span> <span class="s1">'receiver@address'</span><span class="p">,</span>
- <span class="nx">subject</span><span class="o">:</span> <span class="s1">'hello'</span><span class="p">,</span>
- <span class="nx">text</span><span class="o">:</span> <span class="s1">'hello world!'</span>
-<span class="p">});</span>
-</pre></div>
+<div class="highlight highlight-javascript"><pre><span class="pl-s">var</span> nodemailer <span class="pl-ko">=</span> <span class="pl-sf">require</span>(<span class="pl-s1"><span class="pl-pds">'</span>nodemailer<span class="pl-pds">'</span></span>);
+<span class="pl-s">var</span> transporter <span class="pl-ko">=</span> nodemailer.createTransport({
+ service<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>gmail<span class="pl-pds">'</span></span>,
+ auth<span class="pl-ko">:</span> {
+ user<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>sender@gmail.com<span class="pl-pds">'</span></span>,
+ pass<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>password<span class="pl-pds">'</span></span>
+ }
+});
+transporter.sendMail({
+ from<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>sender@address<span class="pl-pds">'</span></span>,
+ to<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>receiver@address<span class="pl-pds">'</span></span>,
+ subject<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>hello<span class="pl-pds">'</span></span>,
+ text<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>hello world!<span class="pl-pds">'</span></span>
+});</pre></div>
<blockquote>
<p>Default SMTP transport is not suitable for large volume of e-mails new SMTP connection is established for every mail sent. Use <a href="https://github.com/andris9/nodemailer-smtp-pool">nodemailer-smtp-pool</a> if you need to send a large amout of e-mails.</p>
@@ -210,28 +218,27 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
</blockquote>
<h4>
-<a name="use-a-transport-plugin" class="anchor" href="#use-a-transport-plugin"><span class="octicon octicon-link"></span></a>Use a transport plugin</h4>
+<a id="use-a-transport-plugin" class="anchor" href="#use-a-transport-plugin" aria-hidden="true"><span class="octicon octicon-link"></span></a>Use a transport plugin</h4>
<p>See <a href="#available-transports">Available Transports</a> for known transport plugins but there might be non listed plugins as well.</p>
<p>The following example uses <a href="https://github.com/andris9/nodemailer-ses-transport">nodemailer-ses-transport</a> (Amazon SES).</p>
-<div class="highlight highlight-javascript"><pre><span class="kd">var</span> <span class="nx">nodemailer</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">'nodemailer'</span><span class="p">);</span>
-<span class="kd">var</span> <span class="nx">ses</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">'nodemailer-ses-transport'</span><span class="p">);</span>
-<span class="kd">var</span> <span class="nx">transporter</span> <span class="o">=</span> <span class="nx">nodemailer</span><span class="p">.</span><span class="nx">createTransport</span><span class="p">(</span><span class="nx">ses</span><span class="p">({</span>
- <span class="nx">accessKeyId</span><span class="o">:</span> <span class="s1">'AWSACCESSKEY'</span><span class="p">,</span>
- <span class="nx">secretAccessKey</span><span class="o">:</span> <span class="s1">'AWS/Secret/key'</span>
-<span class="p">}));</span>
-<span class="nx">transporter</span><span class="p">.</span><span class="nx">sendMail</span><span class="p">({</span>
- <span class="nx">from</span><span class="o">:</span> <span class="s1">'sender@address'</span><span class="p">,</span>
- <span class="nx">to</span><span class="o">:</span> <span class="s1">'receiver@address'</span><span class="p">,</span>
- <span class="nx">subject</span><span class="o">:</span> <span class="s1">'hello'</span><span class="p">,</span>
- <span class="nx">text</span><span class="o">:</span> <span class="s1">'hello world!'</span>
-<span class="p">});</span>
-</pre></div>
+<div class="highlight highlight-javascript"><pre><span class="pl-s">var</span> nodemailer <span class="pl-ko">=</span> <span class="pl-sf">require</span>(<span class="pl-s1"><span class="pl-pds">'</span>nodemailer<span class="pl-pds">'</span></span>);
+<span class="pl-s">var</span> ses <span class="pl-ko">=</span> <span class="pl-sf">require</span>(<span class="pl-s1"><span class="pl-pds">'</span>nodemailer-ses-transport<span class="pl-pds">'</span></span>);
+<span class="pl-s">var</span> transporter <span class="pl-ko">=</span> nodemailer.createTransport(ses({
+ accessKeyId<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>AWSACCESSKEY<span class="pl-pds">'</span></span>,
+ secretAccessKey<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>AWS/Secret/key<span class="pl-pds">'</span></span>
+}));
+transporter.sendMail({
+ from<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>sender@address<span class="pl-pds">'</span></span>,
+ to<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>receiver@address<span class="pl-pds">'</span></span>,
+ subject<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>hello<span class="pl-pds">'</span></span>,
+ text<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>hello world!<span class="pl-pds">'</span></span>
+});</pre></div>
<h2>
-<a name="available-transports" class="anchor" href="#available-transports"><span class="octicon octicon-link"></span></a>Available Transports</h2>
+<a id="available-transports" class="anchor" href="#available-transports" aria-hidden="true"><span class="octicon octicon-link"></span></a>Available Transports</h2>
<p><strong>Built in</strong></p>
@@ -240,7 +247,9 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
<strong><a href="https://github.com/andris9/nodemailer-smtp-transport">nodemailer-smtp-transport</a></strong> for sending messages using a SMTP service</li>
<li>
<strong><a href="https://github.com/andris9/nodemailer-direct-transport">nodemailer-direct-transport</a></strong> for sending messages directly to recipients MX servers (zero configuration needed but unreliable)</li>
-</ul><p><strong>Install as dependencies</strong></p>
+</ul>
+
+<p><strong>Install as dependencies</strong></p>
<ul>
<li>
@@ -254,9 +263,13 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
<li>
<strong><a href="https://github.com/andris9/nodemailer-pickup-transport">nodemailer-pickup-transport</a></strong> for storing messages to pickup folders</li>
<li>
+<strong><a href="https://github.com/sendgrid/nodemailer-sendgrid-transport">nodemailer-sendgrid-transport</a></strong> for sending messages through SendGrid's Web API</li>
+<li>
<em>add yours</em> (see transport api documentation <a href="#transports">here</a>)</li>
-</ul><h2>
-<a name="available-plugins" class="anchor" href="#available-plugins"><span class="octicon octicon-link"></span></a>Available Plugins</h2>
+</ul>
+
+<h2>
+<a id="available-plugins" class="anchor" href="#available-plugins" aria-hidden="true"><span class="octicon octicon-link"></span></a>Available Plugins</h2>
<ul>
<li>
@@ -266,14 +279,17 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
<li>
<strong><a href="https://github.com/andris9/nodemailer-html-to-text">nodemailer-html-to-text</a></strong> to auto generate plaintext content from html</li>
<li>
+<strong><a href="https://github.com/yads/nodemailer-express-handlebars">nodemailer-express-handlebars</a></strong> to auto generate html emails from handelbars/mustache templates</li>
+<li>
<em>add yours</em> (see plugin api documentation <a href="#plugin-api">here</a>)</li>
-</ul><h2>
-<a name="sending-mail" class="anchor" href="#sending-mail"><span class="octicon octicon-link"></span></a>Sending mail</h2>
+</ul>
+
+<h2>
+<a id="sending-mail" class="anchor" href="#sending-mail" aria-hidden="true"><span class="octicon octicon-link"></span></a>Sending mail</h2>
<p>Once you have a transporter object you can send mail</p>
-<div class="highlight highlight-javascript"><pre><span class="nx">transporter</span><span class="p">.</span><span class="nx">sendMail</span><span class="p">(</span><span class="nx">data</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span>
-</pre></div>
+<div class="highlight highlight-javascript"><pre>transporter.sendMail(data, callback)</pre></div>
<p>Where</p>
@@ -306,12 +322,14 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
</li>
</ul>
</li>
-</ul><blockquote>
+</ul>
+
+<blockquote>
<p>If the message includes several recipients then the message is considered sent if at least one recipient is accepted</p>
</blockquote>
<h3>
-<a name="e-mail-message-fields" class="anchor" href="#e-mail-message-fields"><span class="octicon octicon-link"></span></a>E-mail message fields</h3>
+<a id="e-mail-message-fields" class="anchor" href="#e-mail-message-fields" aria-hidden="true"><span class="octicon octicon-link"></span></a>E-mail message fields</h3>
<p>The following are the possible fields of an e-mail message:</p>
@@ -319,6 +337,8 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
<li>
<strong>from</strong> - The e-mail address of the sender. All e-mail addresses can be plain <code>'sender@server.com'</code> or formatted <code>'Sender Name &lt;sender@server.com&gt;'</code>, see <a href="#address-formatting">here</a> for details</li>
<li>
+<strong>sender</strong> - An e-mail address that will appear on the <em>Sender:</em> field</li>
+<li>
<strong>to</strong> - Comma separated list or an array of recipients e-mail addresses that will appear on the <em>To:</em> field</li>
<li>
<strong>cc</strong> - Comma separated list or an array of recipients e-mail addresses that will appear on the <em>Cc:</em> field</li>
@@ -352,11 +372,13 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
<strong>date</strong> - optional Date value, current UTC string will be used if not set</li>
<li>
<strong>encoding</strong> - optional transfer encoding for the textual parts (defaults to 'quoted-printable')</li>
-</ul><p>All text fields (e-mail addresses, plaintext body, html body) use UTF-8 as the encoding.
+</ul>
+
+<p>All text fields (e-mail addresses, plaintext body, html body) use UTF-8 as the encoding.
Attachments are streamed as binary.</p>
<h3>
-<a name="attachments" class="anchor" href="#attachments"><span class="octicon octicon-link"></span></a>Attachments</h3>
+<a id="attachments" class="anchor" href="#attachments" aria-hidden="true"><span class="octicon octicon-link"></span></a>Attachments</h3>
<p>Attachment object consists of the following properties:</p>
@@ -375,53 +397,54 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
<strong>contentType</strong> - optional content type for the attachment, if not set will be derived from the <code>filename</code> property</li>
<li>
<strong>contentDisposition</strong> - optional content disposition type for the attachment, defaults to 'attachment'</li>
-</ul><p>Attachments can be added as many as you want.</p>
-
-<div class="highlight highlight-javascript"><pre><span class="kd">var</span> <span class="nx">mailOptions</span> <span class="o">=</span> <span class="p">{</span>
- <span class="p">...</span>
- <span class="nx">attachments</span><span class="o">:</span> <span class="p">[</span>
- <span class="p">{</span> <span class="c1">// utf-8 string as an attachment</span>
- <span class="nx">filename</span><span class="o">:</span> <span class="s1">'text1.txt'</span><span class="p">,</span>
- <span class="nx">content</span><span class="o">:</span> <span class="s1">'hello world!'</span>
- <span class="p">},</span>
- <span class="p">{</span> <span class="c1">// binary buffer as an attachment</span>
- <span class="nx">filename</span><span class="o">:</span> <span class="s1">'text2.txt'</span><span class="p">,</span>
- <span class="nx">content</span><span class="o">:</span> <span class="k">new</span> <span class="nx">Buffer</span><span class="p">(</span><span class="s1">'hello world!'</span><span class="p">,</span><span class="s1">'utf-8'</span><span class="p">)</span>
- <span class="p">},</span>
- <span class="p">{</span> <span class="c1">// file on disk as an attachment</span>
- <span class="nx">filename</span><span class="o">:</span> <span class="s1">'text3.txt'</span><span class="p">,</span>
- <span class="nx">path</span><span class="o">:</span> <span class="s1">'/path/to/file.txt'</span> <span class="c1">// stream this file</span>
- <span class="p">},</span>
- <span class="p">{</span> <span class="c1">// filename and content type is derived from path</span>
- <span class="nx">path</span><span class="o">:</span> <span class="s1">'/path/to/file.txt'</span>
- <span class="p">},</span>
- <span class="p">{</span> <span class="c1">// stream as an attachment</span>
- <span class="nx">filename</span><span class="o">:</span> <span class="s1">'text4.txt'</span><span class="p">,</span>
- <span class="nx">content</span><span class="o">:</span> <span class="nx">fs</span><span class="p">.</span><span class="nx">createReadStream</span><span class="p">(</span><span class="s1">'file.txt'</span><span class="p">)</span>
- <span class="p">},</span>
- <span class="p">{</span> <span class="c1">// define custom content type for the attachment</span>
- <span class="nx">filename</span><span class="o">:</span> <span class="s1">'text.bin'</span><span class="p">,</span>
- <span class="nx">content</span><span class="o">:</span> <span class="s1">'hello world!'</span><span class="p">,</span>
- <span class="nx">contentType</span><span class="o">:</span> <span class="s1">'text/plain'</span>
- <span class="p">},</span>
- <span class="p">{</span> <span class="c1">// use URL as an attachment</span>
- <span class="nx">filename</span><span class="o">:</span> <span class="s1">'license.txt'</span><span class="p">,</span>
- <span class="nx">path</span><span class="o">:</span> <span class="s1">'https://raw.github.com/andris9/Nodemailer/master/LICENSE'</span>
- <span class="p">},</span>
- <span class="p">{</span> <span class="c1">// encoded string as an attachment</span>
- <span class="nx">filename</span><span class="o">:</span> <span class="s1">'text1.txt'</span><span class="p">,</span>
- <span class="nx">content</span><span class="o">:</span> <span class="s1">'aGVsbG8gd29ybGQh'</span><span class="p">,</span>
- <span class="nx">encoding</span><span class="o">:</span> <span class="s1">'base64'</span>
- <span class="p">},</span>
- <span class="p">{</span> <span class="c1">// data uri as an attachment</span>
- <span class="nx">path</span><span class="o">:</span> <span class="s1">'data:text/plain;base64,aGVsbG8gd29ybGQ='</span>
- <span class="p">}</span>
- <span class="p">]</span>
-<span class="p">}</span>
-</pre></div>
+</ul>
+
+<p>Attachments can be added as many as you want.</p>
+
+<div class="highlight highlight-javascript"><pre><span class="pl-s">var</span> mailOptions <span class="pl-ko">=</span> {
+ ...
+ attachments<span class="pl-ko">:</span> [
+ { <span class="pl-c"><span class="pl-pdc">//</span> utf-8 string as an attachment</span>
+ filename<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>text1.txt<span class="pl-pds">'</span></span>,
+ content<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>hello world!<span class="pl-pds">'</span></span>
+ },
+ { <span class="pl-c"><span class="pl-pdc">//</span> binary buffer as an attachment</span>
+ filename<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>text2.txt<span class="pl-pds">'</span></span>,
+ content<span class="pl-ko">:</span> <span class="pl-ko">new</span> <span class="pl-enti">Buffer</span>(<span class="pl-s1"><span class="pl-pds">'</span>hello world!<span class="pl-pds">'</span></span>,<span class="pl-s1"><span class="pl-pds">'</span>utf-8<span class="pl-pds">'</span></span>)
+ },
+ { <span class="pl-c"><span class="pl-pdc">//</span> file on disk as an attachment</span>
+ filename<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>text3.txt<span class="pl-pds">'</span></span>,
+ path<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>/path/to/file.txt<span class="pl-pds">'</span></span> <span class="pl-c"><span class="pl-pdc">//</span> stream this file</span>
+ },
+ { <span class="pl-c"><span class="pl-pdc">//</span> filename and content type is derived from path</span>
+ path<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>/path/to/file.txt<span class="pl-pds">'</span></span>
+ },
+ { <span class="pl-c"><span class="pl-pdc">//</span> stream as an attachment</span>
+ filename<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>text4.txt<span class="pl-pds">'</span></span>,
+ content<span class="pl-ko">:</span> fs.createReadStream(<span class="pl-s1"><span class="pl-pds">'</span>file.txt<span class="pl-pds">'</span></span>)
+ },
+ { <span class="pl-c"><span class="pl-pdc">//</span> define custom content type for the attachment</span>
+ filename<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>text.bin<span class="pl-pds">'</span></span>,
+ content<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>hello world!<span class="pl-pds">'</span></span>,
+ contentType<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>text/plain<span class="pl-pds">'</span></span>
+ },
+ { <span class="pl-c"><span class="pl-pdc">//</span> use URL as an attachment</span>
+ filename<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>license.txt<span class="pl-pds">'</span></span>,
+ path<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>https://raw.github.com/andris9/Nodemailer/master/LICENSE<span class="pl-pds">'</span></span>
+ },
+ { <span class="pl-c"><span class="pl-pdc">//</span> encoded string as an attachment</span>
+ filename<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>text1.txt<span class="pl-pds">'</span></span>,
+ content<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>aGVsbG8gd29ybGQh<span class="pl-pds">'</span></span>,
+ encoding<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>base64<span class="pl-pds">'</span></span>
+ },
+ { <span class="pl-c"><span class="pl-pdc">//</span> data uri as an attachment</span>
+ path<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>data:text/plain;base64,aGVsbG8gd29ybGQ=<span class="pl-pds">'</span></span>
+ }
+ ]
+}</pre></div>
<h3>
-<a name="alternatives" class="anchor" href="#alternatives"><span class="octicon octicon-link"></span></a>Alternatives</h3>
+<a id="alternatives" class="anchor" href="#alternatives" aria-hidden="true"><span class="octicon octicon-link"></span></a>Alternatives</h3>
<p>In addition to text and HTML, any kind of data can be inserted as an alternative content of the main body - for example a word processing document with the same text as in the HTML field. It is the job of the e-mail client to select and show the best fitting alternative to the reader. Usually this field is used for calendar events and such.</p>
@@ -429,22 +452,21 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
<p><strong>Usage example:</strong></p>
-<div class="highlight highlight-javascript"><pre><span class="kd">var</span> <span class="nx">mailOptions</span> <span class="o">=</span> <span class="p">{</span>
- <span class="p">...</span>
- <span class="nx">html</span><span class="o">:</span> <span class="s1">'&lt;b&gt;Hello world!&lt;/b&gt;'</span><span class="p">,</span>
- <span class="nx">alternatives</span><span class="o">:</span> <span class="p">[</span>
- <span class="p">{</span>
- <span class="nx">contentType</span><span class="o">:</span> <span class="s1">'text/x-web-markdown'</span><span class="p">,</span>
- <span class="nx">content</span><span class="o">:</span> <span class="s1">'**Hello world!**'</span>
- <span class="p">}</span>
- <span class="p">]</span>
-<span class="p">}</span>
-</pre></div>
+<div class="highlight highlight-javascript"><pre><span class="pl-s">var</span> mailOptions <span class="pl-ko">=</span> {
+ ...
+ html<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>&lt;b&gt;Hello world!&lt;/b&gt;<span class="pl-pds">'</span></span>,
+ alternatives<span class="pl-ko">:</span> [
+ {
+ contentType<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>text/x-web-markdown<span class="pl-pds">'</span></span>,
+ content<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>**Hello world!**<span class="pl-pds">'</span></span>
+ }
+ ]
+}</pre></div>
<p>Alternatives can be added as many as you want.</p>
<h3>
-<a name="address-formatting" class="anchor" href="#address-formatting"><span class="octicon octicon-link"></span></a>Address Formatting</h3>
+<a id="address-formatting" class="anchor" href="#address-formatting" aria-hidden="true"><span class="octicon octicon-link"></span></a>Address Formatting</h3>
<p>All the e-mail addresses can be plain e-mail addresses</p>
@@ -480,7 +502,7 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
</code></pre>
<h3>
-<a name="smtp-envelope" class="anchor" href="#smtp-envelope"><span class="octicon octicon-link"></span></a>SMTP envelope</h3>
+<a id="smtp-envelope" class="anchor" href="#smtp-envelope" aria-hidden="true"><span class="octicon octicon-link"></span></a>SMTP envelope</h3>
<p>SMTP envelope is usually auto generated from <code>from</code>, <code>to</code>, <code>cc</code> and <code>bcc</code> fields but
if for some reason you want to specify it yourself, you can do it with <code>envelope</code> property.</p>
@@ -488,41 +510,39 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
<p><code>envelope</code> is an object with the following params: <code>from</code>, <code>to</code>, <code>cc</code> and <code>bcc</code> just like
with regular mail options. You can also use the regular address format, unicode domains etc.</p>
-<div class="highlight highlight-javascript"><pre><span class="nx">mailOptions</span> <span class="o">=</span> <span class="p">{</span>
- <span class="p">...,</span>
- <span class="nx">from</span><span class="o">:</span> <span class="s1">'mailer@kreata.ee'</span><span class="p">,</span>
- <span class="nx">to</span><span class="o">:</span> <span class="s1">'daemon@kreata.ee'</span><span class="p">,</span>
- <span class="nx">envelope</span><span class="o">:</span> <span class="p">{</span>
- <span class="nx">from</span><span class="o">:</span> <span class="s1">'Daemon &lt;deamon@kreata.ee&gt;'</span><span class="p">,</span>
- <span class="nx">to</span><span class="o">:</span> <span class="s1">'mailer@kreata.ee, Mailer &lt;mailer2@kreata.ee&gt;'</span>
- <span class="p">}</span>
-<span class="p">}</span>
-</pre></div>
+<div class="highlight highlight-javascript"><pre>mailOptions <span class="pl-ko">=</span> {
+ ...,
+ from<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>mailer@kreata.ee<span class="pl-pds">'</span></span>,
+ to<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>daemon@kreata.ee<span class="pl-pds">'</span></span>,
+ envelope<span class="pl-ko">:</span> {
+ from<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>Daemon &lt;deamon@kreata.ee&gt;<span class="pl-pds">'</span></span>,
+ to<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>mailer@kreata.ee, Mailer &lt;mailer2@kreata.ee&gt;<span class="pl-pds">'</span></span>
+ }
+}</pre></div>
<blockquote>
<p>Not all transports can use the <code>envelope</code> object, for example SES ignores it and uses the data from the From:, To: etc. headers.</p>
</blockquote>
<h3>
-<a name="using-embedded-images" class="anchor" href="#using-embedded-images"><span class="octicon octicon-link"></span></a>Using Embedded Images</h3>
+<a id="using-embedded-images" class="anchor" href="#using-embedded-images" aria-hidden="true"><span class="octicon octicon-link"></span></a>Using Embedded Images</h3>
<p>Attachments can be used as embedded images in the HTML body. To use this feature, you need to set additional property of the attachment - <code>cid</code> (unique identifier of the file) which is a reference to the attachment file. The same <code>cid</code> value must be used as the image URL in HTML (using <code>cid:</code> as the URL protocol, see example below).</p>
<p><strong>NB!</strong> the cid value should be as unique as possible!</p>
-<div class="highlight highlight-javascript"><pre><span class="kd">var</span> <span class="nx">mailOptions</span> <span class="o">=</span> <span class="p">{</span>
- <span class="p">...</span>
- <span class="nx">html</span><span class="o">:</span> <span class="s1">'Embedded image: &lt;img src="cid:unique@kreata.ee"/&gt;'</span><span class="p">,</span>
- <span class="nx">attachments</span><span class="o">:</span> <span class="p">[{</span>
- <span class="nx">filename</span><span class="o">:</span> <span class="s1">'image.png'</span><span class="p">,</span>
- <span class="nx">path</span><span class="o">:</span> <span class="s1">'/path/to/file'</span><span class="p">,</span>
- <span class="nx">cid</span><span class="o">:</span> <span class="s1">'unique@kreata.ee'</span> <span class="c1">//same cid value as in the html img src</span>
- <span class="p">}]</span>
-<span class="p">}</span>
-</pre></div>
+<div class="highlight highlight-javascript"><pre><span class="pl-s">var</span> mailOptions <span class="pl-ko">=</span> {
+ ...
+ html<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>Embedded image: &lt;img src="cid:unique@kreata.ee"/&gt;<span class="pl-pds">'</span></span>,
+ attachments<span class="pl-ko">:</span> [{
+ filename<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>image.png<span class="pl-pds">'</span></span>,
+ path<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>/path/to/file<span class="pl-pds">'</span></span>,
+ cid<span class="pl-ko">:</span> <span class="pl-s1"><span class="pl-pds">'</span>unique@kreata.ee<span class="pl-pds">'</span></span> <span class="pl-c"><span class="pl-pdc">//</span>same cid value as in the html img src</span>
+ }]
+}</pre></div>
<h2>
-<a name="plugin-system" class="anchor" href="#plugin-system"><span class="octicon octicon-link"></span></a>Plugin system</h2>
+<a id="plugin-system" class="anchor" href="#plugin-system" aria-hidden="true"><span class="octicon octicon-link"></span></a>Plugin system</h2>
<p>There are 3 stages a plugin can hook to</p>
@@ -533,13 +553,14 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
<strong>'stream'</strong> is the step where message tree has been compiled and is ready to be streamed. At this step you can modify the generated MIME tree or add a transform stream that the generated raw e-mail will be piped through before passed to the transport object. Example: <a href="https://github.com/andris9/nodemailer-dkim">nodemailer-dkim</a> that adds DKIM signature to the generated message.</li>
<li>
<strong>Transport</strong> step where the raw e-mail is streamed to destination. Example: <a href="https://github.com/andris9/nodemailer-smtp-transport">nodemailer-smtp-transport</a> that streams the message to a SMTP server.</li>
-</ol><h3>
-<a name="including-plugins" class="anchor" href="#including-plugins"><span class="octicon octicon-link"></span></a>Including plugins</h3>
+</ol>
+
+<h3>
+<a id="including-plugins" class="anchor" href="#including-plugins" aria-hidden="true"><span class="octicon octicon-link"></span></a>Including plugins</h3>
<p>'compile' and 'stream' plugins can be attached with <code>use(plugin)</code> method</p>
-<div class="highlight highlight-javascript"><pre><span class="nx">transporter</span><span class="p">.</span><span class="nx">use</span><span class="p">(</span><span class="nx">step</span><span class="p">,</span> <span class="nx">pluginFunc</span><span class="p">)</span>
-</pre></div>
+<div class="highlight highlight-javascript"><pre>transporter.use(step, pluginFunc)</pre></div>
<p>Where</p>
@@ -551,8 +572,10 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
<strong>step</strong> is a string, either 'compile' or 'stream' thatd defines when the plugin should be hooked</li>
<li>
<strong>pluginFunc</strong> is a function that takes two arguments: the mail object and a callback function</li>
-</ul><h2>
-<a name="plugin-api" class="anchor" href="#plugin-api"><span class="octicon octicon-link"></span></a>Plugin API</h2>
+</ul>
+
+<h2>
+<a id="plugin-api" class="anchor" href="#plugin-api" aria-hidden="true"><span class="octicon octicon-link"></span></a>Plugin API</h2>
<p>All plugins (including transports) get two arguments, the mail object and a callback function.</p>
@@ -565,14 +588,15 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
<strong>message</strong> is the <a href="https://github.com/andris9/buildmail">BuildMail</a> object of the message. This is available for the 'stream' step and for the transport but not for 'compile'.</li>
<li>
<strong>resolveContent</strong> is a helper function for converting Nodemailer compatible stream objects into Strings or Buffers</li>
-</ul><h3>
-<a name="resolvecontent" class="anchor" href="#resolvecontent"><span class="octicon octicon-link"></span></a>resolveContent()</h3>
+</ul>
+
+<h3>
+<a id="resolvecontent" class="anchor" href="#resolvecontent" aria-hidden="true"><span class="octicon octicon-link"></span></a>resolveContent()</h3>
<p>If your plugin needs to get the full value of a param, for example the String value for the <code>html</code> content, you can use <code>resolveContent()</code> to convert Nodemailer
compatible content objects to Strings or Buffers.</p>
-<div class="highlight highlight-javascript"><pre><span class="nx">data</span><span class="p">.</span><span class="nx">resolveContent</span><span class="p">(</span><span class="nx">obj</span><span class="p">,</span> <span class="nx">key</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span>
-</pre></div>
+<div class="highlight highlight-javascript"><pre>data.resolveContent(obj, key, callback)</pre></div>
<p>Where</p>
@@ -583,22 +607,23 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
<strong>key</strong> is the name of the property you want to convert</li>
<li>
<strong>callback</strong> is the callback function with (err, value) where <code>value</code> is either a String or Buffer, depending on the input</li>
-</ul><p><strong>Example</strong></p>
-
-<div class="highlight highlight-javascript"><pre><span class="kd">function</span> <span class="nx">plugin</span><span class="p">(</span><span class="nx">mail</span><span class="p">,</span> <span class="nx">callback</span><span class="p">){</span>
- <span class="c1">// if mail.data.html is a file or an url, it is returned as a Buffer</span>
- <span class="nx">mail</span><span class="p">.</span><span class="nx">resolveContent</span><span class="p">(</span><span class="nx">mail</span><span class="p">.</span><span class="nx">data</span><span class="p">,</span> <span class="s1">'html'</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="nx">html</span><span class="p">){</span>
- <span class="k">if</span><span class="p">(</span><span class="nx">err</span><span class="p">){</span>
- <span class="k">return</span> <span class="nx">callback</span><span class="p">(</span><span class="nx">err</span><span class="p">);</span>
- <span class="p">}</span>
- <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">'HTML contents: %s'</span><span class="p">,</span> <span class="nx">html</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
- <span class="nx">callback</span><span class="p">();</span>
- <span class="p">});</span>
-<span class="p">};</span>
-</pre></div>
+</ul>
+
+<p><strong>Example</strong></p>
+
+<div class="highlight highlight-javascript"><pre><span class="pl-s">function</span> <span class="pl-enf">plugin</span>(<span class="pl-vpf">mail</span>, <span class="pl-vpf">callback</span>){
+ <span class="pl-c"><span class="pl-pdc">//</span> if mail.data.html is a file or an url, it is returned as a Buffer</span>
+ mail.resolveContent(mail.data, <span class="pl-s1"><span class="pl-pds">'</span>html<span class="pl-pds">'</span></span>, <span class="pl-s">function</span>(<span class="pl-vpf">err</span>, <span class="pl-vpf">html</span>){
+ <span class="pl-k">if</span>(err){
+ <span class="pl-k">return</span> callback(err);
+ }
+ console<span class="pl-sf">.log</span>(<span class="pl-s1"><span class="pl-pds">'</span>HTML contents: %s<span class="pl-pds">'</span></span>, html.<span class="pl-sf">toString</span>());
+ callback();
+ });
+};</pre></div>
<h3>
-<a name="compile" class="anchor" href="#compile"><span class="octicon octicon-link"></span></a>'compile'</h3>
+<a id="compile" class="anchor" href="#compile" aria-hidden="true"><span class="octicon octicon-link"></span></a>'compile'</h3>
<p>Compile step plugins get only the <code>mail.data</code> object but not <code>mail.message</code> in the <code>mail</code> argument of the plugin function. If you need to access the <code>mail.message</code> as well use 'stream' step instead.</p>
@@ -608,18 +633,17 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
<p>The following plugin checks if <code>text</code> value is set and if not converts <code>html</code> value to <code>text</code> by removing all html tags.</p>
-<div class="highlight highlight-javascript"><pre><span class="nx">transporter</span><span class="p">.</span><span class="nx">use</span><span class="p">(</span><span class="s1">'compile'</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">mail</span><span class="p">,</span> <span class="nx">callback</span><span class="p">){</span>
- <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="nx">mail</span><span class="p">.</span><span class="nx">text</span> <span class="o">&amp;&amp;</span> <span class="nx">mail</span><span class="p">.</span><span class="nx">html</span><span class="p">){</span>
- <span class="nx">mail</span><span class="p">.</span><span class="nx">text</span> <span class="o">=</span> <span class="nx">mail</span><span class="p">.</span><span class="nx">html</span><span class="p">.</span><span class="nx">replace</span><span class="p">(</span><span class="sr">/&lt;[^&gt;]*&gt;/g</span><span class="p">,</span> <span class="s1">' '</span><span class="p">);</span>
- <span class="p">}</span>
- <span class="nx">callback</span><span class="p">();</span>
-<span class="p">});</span>
-</pre></div>
+<div class="highlight highlight-javascript"><pre>transporter.use(<span class="pl-s1"><span class="pl-pds">'</span>compile<span class="pl-pds">'</span></span>, <span class="pl-s">function</span>(<span class="pl-vpf">mail</span>, <span class="pl-vpf">callback</span>){
+ <span class="pl-k">if</span>(<span class="pl-ko">!</span>mail.text <span class="pl-ko">&amp;&amp;</span> mail.html){
+ mail.text <span class="pl-ko">=</span> mail.html.<span class="pl-sf">replace</span>(<span class="pl-sr"><span class="pl-pds">/</span>&lt;<span class="pl-c1">[<span class="pl-ko">^</span>&gt;]</span><span class="pl-ko">*</span>&gt;<span class="pl-pds">/</span>g</span>, <span class="pl-s1"><span class="pl-pds">'</span> <span class="pl-pds">'</span></span>);
+ }
+ callback();
+});</pre></div>
<p>See <a href="examples/plugin-compile.js">plugin-compile.js</a> for a working example.</p>
<h3>
-<a name="stream" class="anchor" href="#stream"><span class="octicon octicon-link"></span></a>'stream'</h3>
+<a id="stream" class="anchor" href="#stream" aria-hidden="true"><span class="octicon octicon-link"></span></a>'stream'</h3>
<p>Streaming step is invoked once the message structure is built and ready to be streamed to the transport. Plugin function still gets <code>mail.data</code> but it is included just for the reference, modifying it should not change anything (unless the transport requires something from the <code>mail.data</code>, for example <code>mail.data.envelope</code>).</p>
@@ -631,24 +655,23 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
<p>The following plugin replaces all tabs with spaces in the raw message.</p>
-<div class="highlight highlight-javascript"><pre><span class="kd">var</span> <span class="nx">transformer</span> <span class="o">=</span> <span class="k">new</span> <span class="p">(</span><span class="nx">require</span><span class="p">(</span><span class="s1">'stream'</span><span class="p">).</span><span class="nx">Transform</span><span class="p">)();</span>
-<span class="nx">transformer</span><span class="p">.</span><span class="nx">_transform</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">chunk</span><span class="p">,</span> <span class="nx">encoding</span><span class="p">,</span> <span class="nx">done</span><span class="p">)</span> <span class="p">{</span>
- <span class="c1">// replace all tabs with spaces in the stream chunk</span>
- <span class="k">for</span><span class="p">(</span><span class="kd">var</span> <span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">chunk</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">){</span>
- <span class="k">if</span><span class="p">(</span><span class="nx">chunk</span><span class="p">[</span><span class="nx">i</span><span class="p">]</span> <span class="o">===</span> <span class="mh">0x09</span><span class="p">){</span>
- <span class="nx">chunk</span><span class="p">[</span><span class="nx">i</span><span class="p">]</span> <span class="o">=</span> <span class="mh">0x20</span><span class="p">;</span>
- <span class="p">}</span>
- <span class="p">}</span>
- <span class="k">this</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="nx">chunk</span><span class="p">);</span>
- <span class="nx">done</span><span class="p">();</span>
-<span class="p">};</span>
-
-<span class="nx">transporter</span><span class="p">.</span><span class="nx">use</span><span class="p">(</span><span class="s1">'stream'</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">mail</span><span class="p">,</span> <span class="nx">callback</span><span class="p">){</span>
- <span class="c1">// apply output transformer to the raw message stream</span>
- <span class="nx">mail</span><span class="p">.</span><span class="nx">message</span><span class="p">.</span><span class="nx">transform</span><span class="p">(</span><span class="nx">transformer</span><span class="p">);</span>
- <span class="nx">callback</span><span class="p">();</span>
-<span class="p">});</span>
-</pre></div>
+<div class="highlight highlight-javascript"><pre><span class="pl-s">var</span> transformer <span class="pl-ko">=</span> <span class="pl-ko">new</span> (<span class="pl-sf">require</span>(<span class="pl-s1"><span class="pl-pds">'</span>stream<span class="pl-pds">'</span></span>).Transform)();
+<span class="pl-sc">transformer</span>.<span class="pl-enf">_transform</span> <span class="pl-ko">=</span> <span class="pl-s">function</span>(<span class="pl-vpf">chunk</span>, <span class="pl-vpf">encoding</span>, <span class="pl-vpf">done</span>) {
+ <span class="pl-c"><span class="pl-pdc">//</span> replace all tabs with spaces in the stream chunk</span>
+ <span class="pl-k">for</span>(<span class="pl-s">var</span> i <span class="pl-ko">=</span> <span class="pl-cn">0</span>; i <span class="pl-ko">&lt;</span> chunk.length; i<span class="pl-ko">++</span>){
+ <span class="pl-k">if</span>(chunk[i] <span class="pl-ko">===</span> <span class="pl-cn">0x09</span>){
+ chunk[i] <span class="pl-ko">=</span> <span class="pl-cn">0x20</span>;
+ }
+ }
+ <span class="pl-v">this</span>.<span class="pl-sf">push</span>(chunk);
+ done();
+};
+
+transporter.use(<span class="pl-s1"><span class="pl-pds">'</span>stream<span class="pl-pds">'</span></span>, <span class="pl-s">function</span>(<span class="pl-vpf">mail</span>, <span class="pl-vpf">callback</span>){
+ <span class="pl-c"><span class="pl-pdc">//</span> apply output transformer to the raw message stream</span>
+ mail.message.transform(transformer);
+ callback();
+});</pre></div>
<p>See <a href="examples/plugin-stream.js">plugin-stream.js</a> for a working example.</p>
@@ -658,18 +681,17 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
<p>The following plugin prints address information to console.</p>
-<div class="highlight highlight-javascript"><pre><span class="nx">transporter</span><span class="p">.</span><span class="nx">use</span><span class="p">(</span><span class="s1">'stream'</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">mail</span><span class="p">,</span> <span class="nx">callback</span><span class="p">){</span>
- <span class="kd">var</span> <span class="nx">addresses</span> <span class="o">=</span> <span class="nx">mail</span><span class="p">.</span><span class="nx">message</span><span class="p">.</span><span class="nx">getAddresses</span><span class="p">();</span>
- <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">'From: %s'</span><span class="p">,</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">stringify</span><span class="p">(</span><span class="nx">addresses</span><span class="p">.</span><span class="nx">from</span><span class="p">));</span>
- <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">'To: %s'</span><span class="p">,</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">stringify</span><span class="p">(</span><span class="nx">addresses</span><span class="p">.</span><span class="nx">to</span><span class="p">));</span>
- <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">'Cc: %s'</span><span class="p">,</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">stringify</span><span class="p">(</span><span class="nx">addresses</span><span class="p">.</span><span class="nx">cc</span><span class="p">));</span>
- <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">'Bcc: %s'</span><span class="p">,</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">stringify</span><span class="p">(</span><span class="nx">addresses</span><span class="p">.</span><span class="nx">bcc</span><span class="p">));</span>
- <span class="nx">callback</span><span class="p">();</span>
-<span class="p">});</span>
-</pre></div>
+<div class="highlight highlight-javascript"><pre>transporter.use(<span class="pl-s1"><span class="pl-pds">'</span>stream<span class="pl-pds">'</span></span>, <span class="pl-s">function</span>(<span class="pl-vpf">mail</span>, <span class="pl-vpf">callback</span>){
+ <span class="pl-s">var</span> addresses <span class="pl-ko">=</span> mail.message.getAddresses();
+ console<span class="pl-sf">.log</span>(<span class="pl-s1"><span class="pl-pds">'</span>From: %s<span class="pl-pds">'</span></span>, JSON.stringify(addresses.from));
+ console<span class="pl-sf">.log</span>(<span class="pl-s1"><span class="pl-pds">'</span>To: %s<span class="pl-pds">'</span></span>, JSON.stringify(addresses.to));
+ console<span class="pl-sf">.log</span>(<span class="pl-s1"><span class="pl-pds">'</span>Cc: %s<span class="pl-pds">'</span></span>, JSON.stringify(addresses.cc));
+ console<span class="pl-sf">.log</span>(<span class="pl-s1"><span class="pl-pds">'</span>Bcc: %s<span class="pl-pds">'</span></span>, JSON.stringify(addresses.bcc));
+ callback();
+});</pre></div>
<h3>
-<a name="transports" class="anchor" href="#transports"><span class="octicon octicon-link"></span></a>Transports</h3>
+<a id="transports" class="anchor" href="#transports" aria-hidden="true"><span class="octicon octicon-link"></span></a>Transports</h3>
<p>Transports are objects that have a method <code>send</code> and properies <code>name</code> and <code>version</code>. Additionally, if the transport object is an Event Emitter, 'log' events are piped through Nodemailer. A transport object is passed to the <code>nodemailer.createTransport(transport)</code> method to create the transporter object.</p>
@@ -677,15 +699,13 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
<p>This is the name of the transport object. For example 'SMTP' or 'SES' etc.</p>
-<div class="highlight highlight-javascript"><pre><span class="nx">transport</span><span class="p">.</span><span class="nx">name</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">'package.json'</span><span class="p">).</span><span class="nx">name</span><span class="p">;</span>
-</pre></div>
+<div class="highlight highlight-javascript"><pre>transport.name <span class="pl-ko">=</span> <span class="pl-sf">require</span>(<span class="pl-s1"><span class="pl-pds">'</span>package.json<span class="pl-pds">'</span></span>).name;</pre></div>
<p><strong><code>transport.version</code></strong></p>
<p>This should be the transport module version. For example '0.1.0'.</p>
-<div class="highlight highlight-javascript"><pre><span class="nx">transport</span><span class="p">.</span><span class="nx">version</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">'package.json'</span><span class="p">).</span><span class="nx">version</span><span class="p">;</span>
-</pre></div>
+<div class="highlight highlight-javascript"><pre>transport.version <span class="pl-ko">=</span> <span class="pl-sf">require</span>(<span class="pl-s1"><span class="pl-pds">'</span>package.json<span class="pl-pds">'</span></span>).version;</pre></div>
<p><strong><code>transport.send(mail, callback)</code></strong></p>
@@ -695,17 +715,16 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
<p>The following example pipes the raw stream to the console.</p>
-<div class="highlight highlight-javascript"><pre><span class="nx">transport</span><span class="p">.</span><span class="nx">send</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">mail</span><span class="p">,</span> <span class="nx">callback</span><span class="p">){</span>
- <span class="kd">var</span> <span class="nx">input</span> <span class="o">=</span> <span class="nx">mail</span><span class="p">.</span><span class="nx">message</span><span class="p">.</span><span class="nx">createReadStream</span><span class="p">();</span>
- <span class="kd">var</span> <span class="nx">messageId</span> <span class="o">=</span> <span class="p">(</span><span class="nx">mail</span><span class="p">.</span><span class="nx">message</span><span class="p">.</span><span class="nx">getHeader</span><span class="p">(</span><span class="s1">'message-id'</span><span class="p">)</span> <span class="o">||</span> <span class="s1">''</span><span class="p">).</span><span class="nx">replace</span><span class="p">(</span><span class="sr">/[&lt;&gt;\s]/g</span><span class="p">,</span> <span class="s1">''</span><span class="p">);</span>
- <span class="nx">input</span><span class="p">.</span><span class="nx">pipe</span><span class="p">(</span><span class="nx">process</span><span class="p">.</span><span class="nx">stdout</span><span class="p">);</span>
- <span class="nx">input</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="s1">'end'</span><span class="p">,</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
- <span class="nx">callback</span><span class="p">(</span><span class="kc">null</span><span class="p">,</span> <span class="p">{</span>
- <span class="nx">messageId</span><span class="o">:</span> <span class="nx">messageId</span>
- <span class="p">});</span>
- <span class="p">});</span>
-<span class="p">};</span>
-</pre></div>
+<div class="highlight highlight-javascript"><pre><span class="pl-sc">transport</span>.<span class="pl-enf">send</span> <span class="pl-ko">=</span> <span class="pl-s">function</span>(<span class="pl-vpf">mail</span>, <span class="pl-vpf">callback</span>){
+ <span class="pl-s">var</span> input <span class="pl-ko">=</span> mail.message.createReadStream();
+ <span class="pl-s">var</span> messageId <span class="pl-ko">=</span> (mail.message.getHeader(<span class="pl-s1"><span class="pl-pds">'</span>message-id<span class="pl-pds">'</span></span>) <span class="pl-ko">||</span> <span class="pl-s1"><span class="pl-pds">'</span><span class="pl-pds">'</span></span>).<span class="pl-sf">replace</span>(<span class="pl-sr"><span class="pl-pds">/</span><span class="pl-c1">[&lt;&gt;<span class="pl-c1">\s</span>]</span><span class="pl-pds">/</span>g</span>, <span class="pl-s1"><span class="pl-pds">'</span><span class="pl-pds">'</span></span>);
+ input.pipe(process.stdout);
+ input.on(<span class="pl-s1"><span class="pl-pds">'</span>end<span class="pl-pds">'</span></span>, <span class="pl-s">function</span>() {
+ callback(<span class="pl-c1">null</span>, {
+ messageId<span class="pl-ko">:</span> messageId
+ });
+ });
+};</pre></div>
<p><strong><code>transport.close(args*)</code></strong></p>
@@ -724,7 +743,7 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
<p>See <a href="examples/minimal-transport.js">minimal-transport.js</a> for a working example.</p>
<h2>
-<a name="using-gmail" class="anchor" href="#using-gmail"><span class="octicon octicon-link"></span></a>Using Gmail</h2>
+<a id="using-gmail" class="anchor" href="#using-gmail" aria-hidden="true"><span class="octicon octicon-link"></span></a>Using Gmail</h2>
<p>Even though Gmail is the fastest way to get started with sending emails, it is by no means a preferable solution unless you are using OAuth2 authentication. Gmail expects the user to be an actual user not a robot so it runs a lot of heuristics for every login attempt and blocks anything that looks suspicious to defend the user from account hijacking attempts. For example you might run into trouble if your server is in another geographical location – everything works in your dev machine but messages are blocked in production.</p>
@@ -733,7 +752,7 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
<p>To prevent having login issues you should either use XOAUTH2 (see details <a href="https://github.com/andris9/nodemailer-smtp-transport#authentication">here</a>) or use another provider and preferably a dedicated one like <a href="http://www.mailgun.com/">Mailgun</a> or <a href="http://mbsy.co/sendgrid/12237825">SendGrid</a> or any other. Usually these providers have free plans available that are compareable to the daily sending limits of Gmail. Gmail has a limit of 500 recipients a day (a message with one <em>To</em> and one <em>Cc</em> address counts as two messages since it has two recipients) for @gmail.com addresses and 2000 for Google Apps customers, larger SMTP providers usually offer about 200-300 recipients a day for free.</p>
<h2>
-<a name="delivering-bulk-mail" class="anchor" href="#delivering-bulk-mail"><span class="octicon octicon-link"></span></a>Delivering Bulk Mail</h2>
+<a id="delivering-bulk-mail" class="anchor" href="#delivering-bulk-mail" aria-hidden="true"><span class="octicon octicon-link"></span></a>Delivering Bulk Mail</h2>
<p>Here are some tips how to handle bulk mail, for example if you need to send 10 million messages at once (originally published as a <a href="http://www.andrisreinman.com/delivering-bulk-mail-with-nodemailer/">blog post</a>).</p>
@@ -751,23 +770,23 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
<li>
<strong>Use file paths not URLs for attachments.</strong> If you are reading the same file from the disk several million times, the contents for the file probably get cached somewhere between your app and the physical hard disk, so you get your files back quicker (assuming you send the same attachment to all recipients). There is nothing like this for URLs – every new message makes a fresh HTTP fetch to receive the file from the server.</li>
<li>If the SMTP service accepts HTTP API as well you still might prefer SMTP and not the HTTP API as HTTP introduces additional overhead. You probably want to use HTTP over SMTP if the HTTP API is bulk aware – you send a message template and the list of 10 million recipients and the service compiles this information into e-mails itself, you can't beat this with SMTP.</li>
-</ol><h2>
-<a name="license" class="anchor" href="#license"><span class="octicon octicon-link"></span></a>License</h2>
+</ol>
+
+<h2>
+<a id="license" class="anchor" href="#license" aria-hidden="true"><span class="octicon octicon-link"></span></a>License</h2>
<p><strong>Nodemailer</strong> is licensed under <a href="https://github.com/andris9/Nodemailer/blob/master/LICENSE">MIT license</a>. Basically you can do whatever you want to with it</p>
-<hr><p>The Nodemailer logo was designed by <a href="https://www.behance.net/kristjansen">Sven Kristjansen</a>.</p>
- </section>
- </div>
+<hr>
- <!-- FOOTER -->
- <div id="footer_wrap" class="outer">
- <footer class="inner">
- <p class="copyright">Nodemailer maintained by <a href="https://github.com/andris9">andris9</a></p>
- <p>Published with <a href="http://pages.github.com">GitHub Pages</a></p>
+<p>The Nodemailer logo was designed by <a href="https://www.behance.net/kristjansen">Sven Kristjansen</a>.</p>
+ </section>
+ <footer>
+ <p>Project maintained by <a href="https://github.com/andris9">andris9</a></p>
+ <p><small>Hosted on GitHub Pages &mdash; Theme by <a href="https://twitter.com/michigangraham">mattgraham</a></small></p>
</footer>
</div>
-
+ <!--[if !IE]><script>fixScale(document);</script><![endif]-->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
@@ -779,6 +798,5 @@ <h2 id="project_tagline">Send e-mails from Node.js – easy as cake!</h2>
} catch(err) {}
</script>
-
</body>
-</html>
+</html>
54 javascripts/main.js
View
@@ -1 +1,53 @@
-console.log('This would be the main JS file.');
+var sectionHeight = function() {
+ var total = $(window).height(),
+ $section = $('section').css('height','auto');
+
+ if ($section.outerHeight(true) < total) {
+ var margin = $section.outerHeight(true) - $section.height();
+ $section.height(total - margin - 20);
+ } else {
+ $section.css('height','auto');
+ }
+}
+
+$(window).resize(sectionHeight);
+
+$(document).ready(function(){
+ $("section h1, section h2").each(function(){
+ $("nav ul").append("<li class='tag-" + this.nodeName.toLowerCase() + "'><a href='#" + $(this).text().toLowerCase().replace(/ /g, '-').replace(/[^\w-]+/g,'') + "'>" + $(this).text() + "</a></li>");
+ $(this).attr("id",$(this).text().toLowerCase().replace(/ /g, '-').replace(/[^\w-]+/g,''));
+ $("nav ul li:first-child a").parent().addClass("active");
+ });
+
+ $("nav ul li").on("click", "a", function(event) {
+ var position = $($(this).attr("href")).offset().top - 190;
+ $("html, body").animate({scrollTop: position}, 400);
+ $("nav ul li a").parent().removeClass("active");
+ $(this).parent().addClass("active");
+ event.preventDefault();
+ });
+
+ sectionHeight();
+
+ $('img').load(sectionHeight);
+});
+
+fixScale = function(doc) {
+
+ var addEvent = 'addEventListener',
+ type = 'gesturestart',
+ qsa = 'querySelectorAll',
+ scales = [1, 1],
+ meta = qsa in doc ? doc[qsa]('meta[name=viewport]') : [];
+
+ function fix() {
+ meta.content = 'width=device-width,minimum-scale=' + scales[0] + ',maximum-scale=' + scales[1];
+ doc.removeEventListener(type, fix, true);
+ }
+
+ if ((meta = meta[meta.length - 1]) && addEvent in doc) {
+ fix();
+ scales = [.25, 1.6];
+ doc[addEvent](type, fix, true);
+ }
+};
2  params.json
View
@@ -1 +1 @@
-{"name":"Nodemailer","tagline":"Send e-mails from Node.js – easy as cake!","body":"![Nodemailer](https://raw2.github.com/andris9/Nodemailer/master/assets/nm_logo_200x136.png)\r\n\r\nSend e-mails from Node.js – easy as cake!\r\n\r\n[![Build Status](https://secure.travis-ci.org/andris9/Nodemailer.svg)](http://travis-ci.org/andris9/Nodemailer)\r\n<a href=\"http://badge.fury.io/js/nodemailer\"><img src=\"https://badge.fury.io/js/nodemailer.svg\" alt=\"NPM version\" height=\"18\"></a>\r\n\r\n## Upgrade warning\r\n\r\nDo not upgrade Nodemailer from 0.7 or lower to 1.0 as there are breaking changes. You can continue to use the 0.7 branch as long as you like. See the documentation for 0.7 [here](https://github.com/andris9/Nodemailer/blob/0.7/README.md).\r\n\r\n### Migration guide\r\n\r\nSee the migration guide from 0.7 to 1.0 [in the 1.0 release blog post](http://www.andrisreinman.com/nodemailer-v1-0/#migrationguide).\r\n\r\n## Notes and information\r\n\r\n### Nodemailer supports\r\n\r\n * **Unicode** to use any characters\r\n * **Windows** – you can install it with *npm* on Windows just like any other module, there are no compiled dependencies. Use it from Azure or from your Windows box hassle free.\r\n * **HTML content** as well as **plain text** alternative\r\n * **Attachments** (including attachment **streaming** for sending larger files)\r\n * **Embedded images** in HTML\r\n * Secure e-mail delivery using **SSL/STARTTLS**\r\n * Different **transport methods**, either using built in transports or from external plugins\r\n * Custom **Plugin support** for manipulating messages (add DKIM signatures, use markdown content instead of HTML etc.)\r\n * Sane **XOAUTH2** login with automatic access token generation (and feedback about the updated tokens)\r\n\r\n### Support Nodemailer development\r\n\r\n[![Donate to author](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DB26KWR2BQX5W)\r\n\r\nIf you want to support with Bitcoins, then my wallet address is `15Z8ADxhssKUiwP3jbbqJwA21744KMCfTM`\r\n\r\n## TL;DR Usage Example\r\n\r\nThis is a complete example to send an e-mail with plaintext and HTML body\r\n\r\n```javascript\r\nvar nodemailer = require('nodemailer');\r\n\r\n// create reusable transporter object using SMTP transport\r\nvar transporter = nodemailer.createTransport({\r\n service: 'Gmail',\r\n auth: {\r\n user: 'gmail.user@gmail.com',\r\n pass: 'userpass'\r\n }\r\n});\r\n\r\n// NB! No need to recreate the transporter object. You can use\r\n// the same transporter object for all e-mails\r\n\r\n// setup e-mail data with unicode symbols\r\nvar mailOptions = {\r\n from: 'Fred Foo ✔ <foo@blurdybloop.com>', // sender address\r\n to: 'bar@blurdybloop.com, baz@blurdybloop.com', // list of receivers\r\n subject: 'Hello ✔', // Subject line\r\n text: 'Hello world ✔', // plaintext body\r\n html: '<b>Hello world ✔</b>' // html body\r\n};\r\n\r\n// send mail with defined transport object\r\ntransporter.sendMail(mailOptions, function(error, info){\r\n if(error){\r\n console.log(error);\r\n }else{\r\n console.log('Message sent: ' + info.response);\r\n }\r\n});\r\n```\r\n\r\nSee [nodemailer-smtp-transport](https://github.com/andris9/nodemailer-smtp-transport#usage) for SMTP configuration options and [nodemailer-wellknown](https://github.com/andris9/nodemailer-wellknown#supported-services) for preconfigured service names (example uses 'gmail').\r\n\r\n> When using default SMTP transport, then you do not need to define transport type explicitly (even though you can), just provide the SMTP options and that's it. For anything else, see the docs of the particular [transport mechanism](#available-transports).\r\n\r\n## Goals for 1.0\r\n\r\n### 1. Move optional features out of core\r\n\r\nNodemailer 0.x is quite large and includes a ton of stuff that is not needed for most users. Sometimes it causes problems, for example when\r\na feature that you do not even use requires some dependency to be installed that throws in your environment. If you only use SMTP to send e-mails you do not need the SES code and vice versa. The goal is achieved with a plugin system where you can install and load only these plugins that you actually require.\r\n\r\n### 2. Gigabyte attachments\r\n\r\nVersion 1.0 is a total rewrite from the ground up and relying heavily on Streams2. This allows you to reliably\r\nsend messages with gigabyte attachments even through a slow network connection without CPU or memory penalties. You probably never need it but it makes using smaller attachments more reliable as well.\r\n\r\n## Setting up\r\n\r\nInstall with npm\r\n\r\n npm install nodemailer\r\n\r\nTo send e-mails you need a transporter object\r\n\r\n```javascript\r\nvar transporter = nodemailer.createTransport(transport)\r\n```\r\n\r\nWhere\r\n\r\n * **transporter** is going to be an object that is able to send mail\r\n * **transport** is a transport mechanism. If it is not set [nodemailer-direct-transport](https://github.com/andris9/nodemailer-direct-transport) transport is used. If it is a regular object [nodemailer-smtp-transport](https://github.com/andris9/nodemailer-smtp-transport) is used and the value is passed as SMTP configuration.\r\n\r\n> You have to create the transporter object only once. If you already have a transporter object you can use it to send mail as much as you like.\r\n\r\n### Examples\r\n\r\n#### Use *direct* transport\r\n\r\nIn this case all e-mails are sent directly to the recipients MX server (using port 25)\r\n\r\n```javascript\r\nvar nodemailer = require('nodemailer');\r\nvar transporter = nodemailer.createTransport();\r\ntransporter.sendMail({\r\n from: 'sender@address',\r\n to: 'receiver@address',\r\n subject: 'hello',\r\n text: 'hello world!'\r\n});\r\n```\r\n\r\n> Using *direct* transport is not reliable as outgoing port 25 used is often blocked by default. Additionally mail sent from dynamic addresses is often flagged as spam. You should really consider using a SMTP provider.\r\n\r\n#### Use the default *SMTP* transport\r\n\r\nSee SMTP [configuration options here](https://github.com/andris9/nodemailer-smtp-transport#usage)\r\n\r\n```javascript\r\nvar nodemailer = require('nodemailer');\r\nvar transporter = nodemailer.createTransport({\r\n service: 'gmail',\r\n auth: {\r\n user: 'sender@gmail.com',\r\n pass: 'password'\r\n }\r\n});\r\ntransporter.sendMail({\r\n from: 'sender@address',\r\n to: 'receiver@address',\r\n subject: 'hello',\r\n text: 'hello world!'\r\n});\r\n```\r\n\r\n> Default SMTP transport is not suitable for large volume of e-mails new SMTP connection is established for every mail sent. Use [nodemailer-smtp-pool](https://github.com/andris9/nodemailer-smtp-pool) if you need to send a large amout of e-mails.\r\n>\r\n> For sending bulk mail using Nodemailer see the [recommendations below](#delivering-bulk-mail)\r\n\r\n#### Use a transport plugin\r\n\r\nSee [Available Transports](#available-transports) for known transport plugins but there might be non listed plugins as well.\r\n\r\nThe following example uses [nodemailer-ses-transport](https://github.com/andris9/nodemailer-ses-transport) (Amazon SES).\r\n\r\n```javascript\r\nvar nodemailer = require('nodemailer');\r\nvar ses = require('nodemailer-ses-transport');\r\nvar transporter = nodemailer.createTransport(ses({\r\n accessKeyId: 'AWSACCESSKEY',\r\n secretAccessKey: 'AWS/Secret/key'\r\n}));\r\ntransporter.sendMail({\r\n from: 'sender@address',\r\n to: 'receiver@address',\r\n subject: 'hello',\r\n text: 'hello world!'\r\n});\r\n```\r\n\r\n## Available Transports\r\n\r\n**Built in**\r\n\r\n * **[nodemailer-smtp-transport](https://github.com/andris9/nodemailer-smtp-transport)** for sending messages using a SMTP service\r\n * **[nodemailer-direct-transport](https://github.com/andris9/nodemailer-direct-transport)** for sending messages directly to recipients MX servers (zero configuration needed but unreliable)\r\n\r\n**Install as dependencies**\r\n\r\n * **[nodemailer-smtp-pool](https://github.com/andris9/nodemailer-smtp-pool)** for sending messages to SMTP using pooled connections\r\n * **[nodemailer-ses-transport](https://github.com/andris9/nodemailer-ses-transport)** for sending messages to AWS SES\r\n * **[nodemailer-sendmail-transport](https://github.com/andris9/nodemailer-sendmail-transport)** for piping messages to the *sendmail* command\r\n * **[nodemailer-stub-transport](https://github.com/andris9/nodemailer-stub-transport)** is just for returning messages, most probably for testing purposes\r\n * **[nodemailer-pickup-transport](https://github.com/andris9/nodemailer-pickup-transport)** for storing messages to pickup folders\r\n * *add yours* (see transport api documentation [here](#transports))\r\n\r\n## Available Plugins\r\n\r\n * **[nodemailer-markdown](https://github.com/andris9/nodemailer-markdown)** to use markdown for the content\r\n * **[nodemailer-dkim](https://github.com/andris9/nodemailer-dkim)** to sign messages with DKIM\r\n * **[nodemailer-html-to-text](https://github.com/andris9/nodemailer-html-to-text)** to auto generate plaintext content from html\r\n * *add yours* (see plugin api documentation [here](#plugin-api))\r\n\r\n## Sending mail\r\n\r\nOnce you have a transporter object you can send mail\r\n\r\n```javascript\r\ntransporter.sendMail(data, callback)\r\n```\r\n\r\nWhere\r\n\r\n * **data** defines the mail content (see [e-mail message fields](#e-mail-message-fields) below)\r\n * **callback** is an optional callback function to run once the message is delivered or it failed.\r\n * **err** is the error object if message failed\r\n * **info** includes the result, the exact format depends on the transport mechanism used\r\n * **info.messageId** most transports *should* return the final Message-Id value used with this property\r\n * **info.envelope** includes the envelope object for the message\r\n * **info.accepted** is an array returned by SMTP transports (includes recipient addresses that were accepted by the server)\r\n * **info.rejected** is an array returned by SMTP transports (includes recipient addresses that were rejected by the server)\r\n * **info.pending** is an array returned by Direct SMTP transport. Includes recipient addresses that were temporarily rejected together with the server response\r\n * **response** is a string returned by SMTP transports and includes the last SMTP response from the server\r\n\r\n> If the message includes several recipients then the message is considered sent if at least one recipient is accepted\r\n\r\n### E-mail message fields\r\n\r\nThe following are the possible fields of an e-mail message:\r\n\r\n - **from** - The e-mail address of the sender. All e-mail addresses can be plain `'sender@server.com'` or formatted `'Sender Name <sender@server.com>'`, see [here](#address-formatting) for details\r\n - **to** - Comma separated list or an array of recipients e-mail addresses that will appear on the *To:* field\r\n - **cc** - Comma separated list or an array of recipients e-mail addresses that will appear on the *Cc:* field\r\n - **bcc** - Comma separated list or an array of recipients e-mail addresses that will appear on the *Bcc:* field\r\n - **replyTo** - An e-mail address that will appear on the *Reply-To:* field\r\n - **inReplyTo** - The message-id this message is replying\r\n - **references** - Message-id list (an array or space separated string)\r\n - **subject** - The subject of the e-mail\r\n - **text** - The plaintext version of the message as an Unicode string, Buffer, Stream or an object *{path: '...'}*\r\n - **html** - The HTML version of the message as an Unicode string, Buffer, Stream or an object *{path: '...'}*\r\n - **headers** - An object or array of additional header fields (e.g. *{\"X-Key-Name\": \"key value\"}* or *[{key: \"X-Key-Name\", value: \"val1\"}, {key: \"X-Key-Name\", value: \"val2\"}]*)\r\n - **attachments** - An array of attachment objects (see [below](#attachments) for details)\r\n - **alternatives** - An array of alternative text contents (in addition to text and html parts) (see [below](#alternatives) for details)\r\n - **envelope** - optional SMTP envelope, if auto generated envelope is not suitable (see [below](#smtp-envelope) for details)\r\n - **messageId** - optional Message-Id value, random value will be generated if not set\r\n - **date** - optional Date value, current UTC string will be used if not set\r\n - **encoding** - optional transfer encoding for the textual parts (defaults to 'quoted-printable')\r\n\r\nAll text fields (e-mail addresses, plaintext body, html body) use UTF-8 as the encoding.\r\nAttachments are streamed as binary.\r\n\r\n### Attachments\r\n\r\nAttachment object consists of the following properties:\r\n\r\n * **filename** - filename to be reported as the name of the attached file, use of unicode is allowed\r\n * **cid** - optional content id for using inline images in HTML message source\r\n * **content** - String, Buffer or a Stream contents for the attachment\r\n * **encoding** - If set and `content` is string, then encodes the content to a Buffer using the specified encoding. Example values: `base64`, `hex`, 'binary' etc. Useful if you want to use binary attachments in a JSON formatted e-mail object.\r\n * **path** - path to a file or an URL (data uris are allowed as well) if you want to stream the file instead of including it (better for larger attachments)\r\n * **contentType** - optional content type for the attachment, if not set will be derived from the `filename` property\r\n * **contentDisposition** - optional content disposition type for the attachment, defaults to 'attachment'\r\n\r\nAttachments can be added as many as you want.\r\n\r\n```javascript\r\nvar mailOptions = {\r\n ...\r\n attachments: [\r\n { // utf-8 string as an attachment\r\n filename: 'text1.txt',\r\n content: 'hello world!'\r\n },\r\n { // binary buffer as an attachment\r\n filename: 'text2.txt',\r\n content: new Buffer('hello world!','utf-8')\r\n },\r\n { // file on disk as an attachment\r\n filename: 'text3.txt',\r\n path: '/path/to/file.txt' // stream this file\r\n },\r\n { // filename and content type is derived from path\r\n path: '/path/to/file.txt'\r\n },\r\n { // stream as an attachment\r\n filename: 'text4.txt',\r\n content: fs.createReadStream('file.txt')\r\n },\r\n { // define custom content type for the attachment\r\n filename: 'text.bin',\r\n content: 'hello world!',\r\n contentType: 'text/plain'\r\n },\r\n { // use URL as an attachment\r\n filename: 'license.txt',\r\n path: 'https://raw.github.com/andris9/Nodemailer/master/LICENSE'\r\n },\r\n { // encoded string as an attachment\r\n filename: 'text1.txt',\r\n content: 'aGVsbG8gd29ybGQh',\r\n encoding: 'base64'\r\n },\r\n { // data uri as an attachment\r\n path: 'data:text/plain;base64,aGVsbG8gd29ybGQ='\r\n }\r\n ]\r\n}\r\n```\r\n\r\n### Alternatives\r\n\r\nIn addition to text and HTML, any kind of data can be inserted as an alternative content of the main body - for example a word processing document with the same text as in the HTML field. It is the job of the e-mail client to select and show the best fitting alternative to the reader. Usually this field is used for calendar events and such.\r\n\r\nAlternative objects use the same options as [attachment objects](#attachments). The difference between an attachment and an alternative is the fact that attachments are placed into *multipart/mixed* or *multipart/related* parts of the message white alternatives are placed into *multipart/alternative* part.\r\n\r\n**Usage example:**\r\n\r\n```javascript\r\nvar mailOptions = {\r\n ...\r\n html: '<b>Hello world!</b>',\r\n alternatives: [\r\n {\r\n contentType: 'text/x-web-markdown',\r\n content: '**Hello world!**'\r\n }\r\n ]\r\n}\r\n```\r\n\r\nAlternatives can be added as many as you want.\r\n\r\n### Address Formatting\r\n\r\nAll the e-mail addresses can be plain e-mail addresses\r\n\r\n```\r\nfoobar@blurdybloop.com\r\n```\r\n\r\nor with formatted name (includes unicode support)\r\n\r\n```\r\n\"Ноде Майлер\" <foobar@blurdybloop.com>\r\n```\r\n\r\nor as an address object\r\n\r\n```\r\n{\r\n name: 'Ноде Майлер',\r\n address: 'foobar@blurdybloop.com'\r\n}\r\n```\r\n\r\nTo, Cc and Bcc fields accept comma separated list of e-mails or an array of\r\ne-mails or an array of comma separated list of e-mails - use it as you like.\r\nFormatting can be mixed.\r\n\r\n```\r\n...,\r\nto: 'foobar@blurdybloop.com, \"Ноде Майлер\" <bar@blurdybloop.com>, \"Name, User\" <baz@blurdybloop.com>',\r\ncc: ['foobar@blurdybloop.com', '\"Ноде Майлер\" <bar@blurdybloop.com>, \"Name, User\" <baz@blurdybloop.com>']\r\n...\r\n```\r\n\r\nYou can even use unicode domains, these are automatically converted to punycode\r\n\r\n```\r\n'\"Unicode Domain\" <info@müriaad-polüteism.info>'\r\n```\r\n\r\n### SMTP envelope\r\n\r\nSMTP envelope is usually auto generated from `from`, `to`, `cc` and `bcc` fields but\r\nif for some reason you want to specify it yourself, you can do it with `envelope` property.\r\n\r\n`envelope` is an object with the following params: `from`, `to`, `cc` and `bcc` just like\r\nwith regular mail options. You can also use the regular address format, unicode domains etc.\r\n\r\n```javascript\r\nmailOptions = {\r\n ...,\r\n from: 'mailer@kreata.ee',\r\n to: 'daemon@kreata.ee',\r\n envelope: {\r\n from: 'Daemon <deamon@kreata.ee>',\r\n to: 'mailer@kreata.ee, Mailer <mailer2@kreata.ee>'\r\n }\r\n}\r\n```\r\n\r\n> Not all transports can use the `envelope` object, for example SES ignores it and uses the data from the From:, To: etc. headers.\r\n\r\n### Using Embedded Images\r\n\r\nAttachments can be used as embedded images in the HTML body. To use this feature, you need to set additional property of the attachment - `cid` (unique identifier of the file) which is a reference to the attachment file. The same `cid` value must be used as the image URL in HTML (using `cid:` as the URL protocol, see example below).\r\n\r\n**NB!** the cid value should be as unique as possible!\r\n\r\n```javascript\r\nvar mailOptions = {\r\n ...\r\n html: 'Embedded image: <img src=\"cid:unique@kreata.ee\"/>',\r\n attachments: [{\r\n filename: 'image.png',\r\n path: '/path/to/file',\r\n cid: 'unique@kreata.ee' //same cid value as in the html img src\r\n }]\r\n}\r\n```\r\n\r\n## Plugin system\r\n\r\nThere are 3 stages a plugin can hook to\r\n\r\n 1. **'compile'** is the step where e-mail data is set but nothing has been done with it yet. At this step you can modify mail options, for example modify `html` content, add new headers etc. Example: [nodemailer-markdown](https://github.com/andris9/nodemailer-markdown) that allows you to use `markdown` source instead of `text` and `html`.\r\n 2. **'stream'** is the step where message tree has been compiled and is ready to be streamed. At this step you can modify the generated MIME tree or add a transform stream that the generated raw e-mail will be piped through before passed to the transport object. Example: [nodemailer-dkim](https://github.com/andris9/nodemailer-dkim) that adds DKIM signature to the generated message.\r\n 3. **Transport** step where the raw e-mail is streamed to destination. Example: [nodemailer-smtp-transport](https://github.com/andris9/nodemailer-smtp-transport) that streams the message to a SMTP server.\r\n\r\n### Including plugins\r\n\r\n'compile' and 'stream' plugins can be attached with `use(plugin)` method\r\n\r\n```javascript\r\ntransporter.use(step, pluginFunc)\r\n```\r\n\r\nWhere\r\n\r\n * **transporter** is a transport object created with `createTransport`\r\n * **step** is a string, either 'compile' or 'stream' thatd defines when the plugin should be hooked\r\n * **pluginFunc** is a function that takes two arguments: the mail object and a callback function\r\n\r\n## Plugin API\r\n\r\nAll plugins (including transports) get two arguments, the mail object and a callback function.\r\n\r\nMail object that is passed to the plugin function as the first argument is an object with the following properties:\r\n\r\n * **data** is the mail data object that is passed to the `sendMail` method\r\n * **message** is the [BuildMail](https://github.com/andris9/buildmail) object of the message. This is available for the 'stream' step and for the transport but not for 'compile'.\r\n * **resolveContent** is a helper function for converting Nodemailer compatible stream objects into Strings or Buffers\r\n\r\n### resolveContent()\r\n\r\nIf your plugin needs to get the full value of a param, for example the String value for the `html` content, you can use `resolveContent()` to convert Nodemailer\r\ncompatible content objects to Strings or Buffers.\r\n\r\n```javascript\r\ndata.resolveContent(obj, key, callback)\r\n```\r\n\r\nWhere\r\n\r\n * **obj** is an object that has a property you want to convert to a String or a Buffer\r\n * **key** is the name of the property you want to convert\r\n * **callback** is the callback function with (err, value) where `value` is either a String or Buffer, depending on the input\r\n\r\n**Example**\r\n\r\n```javascript\r\nfunction plugin(mail, callback){\r\n // if mail.data.html is a file or an url, it is returned as a Buffer\r\n mail.resolveContent(mail.data, 'html', function(err, html){\r\n if(err){\r\n return callback(err);\r\n }\r\n console.log('HTML contents: %s', html.toString());\r\n callback();\r\n });\r\n};\r\n```\r\n\r\n### 'compile'\r\n\r\nCompile step plugins get only the `mail.data` object but not `mail.message` in the `mail` argument of the plugin function. If you need to access the `mail.message` as well use 'stream' step instead.\r\n\r\nThis is really straightforward, your plugin can modify the `mail.data` object at will and once everything is finished run the callback function. If the callback gets an error object as an argument, then the process is terminated and the error is returned to the `sendMail` callback.\r\n\r\n**Example**\r\n\r\nThe following plugin checks if `text` value is set and if not converts `html` value to `text` by removing all html tags.\r\n\r\n```javascript\r\ntransporter.use('compile', function(mail, callback){\r\n if(!mail.text && mail.html){\r\n mail.text = mail.html.replace(/<[^>]*>/g, ' ');\r\n }\r\n callback();\r\n});\r\n```\r\n\r\nSee [plugin-compile.js](examples/plugin-compile.js) for a working example.\r\n\r\n### 'stream'\r\n\r\nStreaming step is invoked once the message structure is built and ready to be streamed to the transport. Plugin function still gets `mail.data` but it is included just for the reference, modifying it should not change anything (unless the transport requires something from the `mail.data`, for example `mail.data.envelope`).\r\n\r\nYou can modify the `mail.message` object as you like, the message is not yet streaming anything (message starts streaming when the transport calls `mail.message.createReadStream()`).\r\n\r\nIn most cases you might be interested in the [message.transform()](https://github.com/andris9/buildmail#transform) method for applying transform streams to the raw message.\r\n\r\n**Example**\r\n\r\nThe following plugin replaces all tabs with spaces in the raw message.\r\n\r\n```javascript\r\nvar transformer = new (require('stream').Transform)();\r\ntransformer._transform = function(chunk, encoding, done) {\r\n // replace all tabs with spaces in the stream chunk\r\n for(var i = 0; i < chunk.length; i++){\r\n if(chunk[i] === 0x09){\r\n chunk[i] = 0x20;\r\n }\r\n }\r\n this.push(chunk);\r\n done();\r\n};\r\n\r\ntransporter.use('stream', function(mail, callback){\r\n // apply output transformer to the raw message stream\r\n mail.message.transform(transformer);\r\n callback();\r\n});\r\n```\r\n\r\nSee [plugin-stream.js](examples/plugin-stream.js) for a working example.\r\n\r\nAdditionally you might be interested in the [message.getAddresses()](https://github.com/andris9/buildmail#getaddresses) method that returns the contents for all address fields as structured objects.\r\n\r\n**Example**\r\n\r\nThe following plugin prints address information to console.\r\n\r\n```javascript\r\ntransporter.use('stream', function(mail, callback){\r\n var addresses = mail.message.getAddresses();\r\n console.log('From: %s', JSON.stringify(addresses.from));\r\n console.log('To: %s', JSON.stringify(addresses.to));\r\n console.log('Cc: %s', JSON.stringify(addresses.cc));\r\n console.log('Bcc: %s', JSON.stringify(addresses.bcc));\r\n callback();\r\n});\r\n```\r\n\r\n### Transports\r\n\r\nTransports are objects that have a method `send` and properies `name` and `version`. Additionally, if the transport object is an Event Emitter, 'log' events are piped through Nodemailer. A transport object is passed to the `nodemailer.createTransport(transport)` method to create the transporter object.\r\n\r\n**`transport.name`**\r\n\r\nThis is the name of the transport object. For example 'SMTP' or 'SES' etc.\r\n\r\n```javascript\r\ntransport.name = require('package.json').name;\r\n```\r\n\r\n**`transport.version`**\r\n\r\nThis should be the transport module version. For example '0.1.0'.\r\n\r\n```javascript\r\ntransport.version = require('package.json').version;\r\n```\r\n\r\n**`transport.send(mail, callback)`**\r\n\r\nThis is the method that actually sends out e-mails. The method is basically the same as 'stream' plugin functions. It gets two arguments: `mail` and a callback. To start streaming the message, create the stream with `mail.message.createReadStream()`\r\n\r\nCallback function should return an `info` object as the second arugment. This info object should contain `messageId` value with the Message-Id header (without the surrounding &lt; &gt; brackets)\r\n\r\nThe following example pipes the raw stream to the console.\r\n\r\n```javascript\r\ntransport.send = function(mail, callback){\r\n var input = mail.message.createReadStream();\r\n var messageId = (mail.message.getHeader('message-id') || '').replace(/[<>\\s]/g, '');\r\n input.pipe(process.stdout);\r\n input.on('end', function() {\r\n callback(null, {\r\n messageId: messageId\r\n });\r\n });\r\n};\r\n```\r\n\r\n**`transport.close(args*)`**\r\n\r\nIf your transport needs to be closed explicitly, you can implement a `close` method.\r\n\r\nThis is purely optional feature and only makes sense in special contexts (eg. closing a SMTP pool).\r\n\r\nOnce you have a transport object, you can create a mail transporter out of it.\r\n\r\n```\r\nvar nodemailer = require('nodemailer');\r\nvar transport = require('some-transport-method');\r\nvar transporter = nodemailer.createTransport(transport);\r\ntransporter.sendMail({mail data});\r\n```\r\n\r\nSee [minimal-transport.js](examples/minimal-transport.js) for a working example.\r\n\r\n## Using Gmail\r\n\r\nEven though Gmail is the fastest way to get started with sending emails, it is by no means a preferable solution unless you are using OAuth2 authentication. Gmail expects the user to be an actual user not a robot so it runs a lot of heuristics for every login attempt and blocks anything that looks suspicious to defend the user from account hijacking attempts. For example you might run into trouble if your server is in another geographical location – everything works in your dev machine but messages are blocked in production.\r\n\r\nAdditionally Gmail has came up with the concept of ['less secure'](https://support.google.com/accounts/answer/6010255?hl=en) apps which is basically anyone who uses plain password to login to Gmail, so you might end up in a situation where one username can send (support for 'less secure' apps is enabled) but other is blocked (support for 'less secure' apps is disabled).\r\n\r\nTo prevent having login issues you should either use XOAUTH2 (see details [here](https://github.com/andris9/nodemailer-smtp-transport#authentication)) or use another provider and preferably a dedicated one like [Mailgun](http://www.mailgun.com/) or [SendGrid](http://mbsy.co/sendgrid/12237825) or any other. Usually these providers have free plans available that are compareable to the daily sending limits of Gmail. Gmail has a limit of 500 recipients a day (a message with one *To* and one *Cc* address counts as two messages since it has two recipients) for @gmail.com addresses and 2000 for Google Apps customers, larger SMTP providers usually offer about 200-300 recipients a day for free.\r\n\r\n## Delivering Bulk Mail\r\n\r\nHere are some tips how to handle bulk mail, for example if you need to send 10 million messages at once (originally published as a [blog post](http://www.andrisreinman.com/delivering-bulk-mail-with-nodemailer/)).\r\n\r\n 1. **Use a dedicated SMTP provider** like [SendGrid](http://mbsy.co/sendgrid/12237825) or [Mailgun](http://www.mailgun.com/) or any other. Do not use services that offer SMTP as a sideline or for free (thats Gmail or the SMTP of your homepage hosting company) to send bulk mail – you'll hit all the hard limits immediatelly or get labelled as spam. Basically you get what you pay for and if you pay zero then your deliverability is near zero as well. E-mail might seem free but it is only free to a certain amount and that amount certainly does not include 10 million e-mails in a short period of time.\r\n 2. **Use a dedicated queue manager,** for example [RabbitMQ](http://www.rabbitmq.com/) for queueing the e-mails. Nodemailer creates a callback function with related scopes etc. for every message so it might be hard on memory if you pile up the data for 10 million messages at once. Better to take the data from a queue when there's a free spot in the connection pool (previously sent message returns its callback).\r\n 3. **Use [nodemailer-smtp-pool](https://github.com/andris9/nodemailer-smtp-pool) transport.** You do not want to have the overhead of creating a new connection and doing the SMTP handshake dance for every single e-mail. Pooled connections make it possible to bring this overhead to a minimum.\r\n 4. **Set `maxMessages` option to `Infinity`** for the nodemailer-smtp-pool transport. Dedicated SMTP providers happily accept all your e-mails as long you are paying for these, so no need to disconnect in the middle if everything is going smoothly. The default value is 100 which means that once a connection is used to send 100 messages it is removed from the pool and a new connection is created.\r\n 5. **Set `maxConnections` to whatever your system can handle.** There might be limits to this on the receiving side, so do not set it to `Infinity`, even 20 is probably much better than the default 5. A larger number means a larger amount of messages are sent in parallel.\r\n 6. **Use file paths not URLs for attachments.** If you are reading the same file from the disk several million times, the contents for the file probably get cached somewhere between your app and the physical hard disk, so you get your files back quicker (assuming you send the same attachment to all recipients). There is nothing like this for URLs – every new message makes a fresh HTTP fetch to receive the file from the server.\r\n 7. If the SMTP service accepts HTTP API as well you still might prefer SMTP and not the HTTP API as HTTP introduces additional overhead. You probably want to use HTTP over SMTP if the HTTP API is bulk aware – you send a message template and the list of 10 million recipients and the service compiles this information into e-mails itself, you can't beat this with SMTP.\r\n\r\n\r\n## License\r\n\r\n**Nodemailer** is licensed under [MIT license](https://github.com/andris9/Nodemailer/blob/master/LICENSE). Basically you can do whatever you want to with it\r\n\r\n----\r\n\r\nThe Nodemailer logo was designed by [Sven Kristjansen](https://www.behance.net/kristjansen).\r\n","google":"UA-51322-34","note":"Don't delete this file! It's used internally to help with page regeneration."}
+{"name":"Nodemailer","tagline":"Send e-mails from Node.js – easy as cake!","body":"![Nodemailer](https://raw.githubusercontent.com/andris9/Nodemailer/master/assets/nm_logo_200x136.png)\r\n\r\nSend e-mails from Node.js – easy as cake!\r\n\r\n[![Build Status](https://secure.travis-ci.org/andris9/Nodemailer.svg)](http://travis-ci.org/andris9/Nodemailer)\r\n<a href=\"http://badge.fury.io/js/nodemailer\"><img src=\"https://badge.fury.io/js/nodemailer.svg\" alt=\"NPM version\" height=\"18\"></a>\r\n\r\n## Upgrade warning\r\n\r\nDo not upgrade Nodemailer from 0.7 or lower to 1.0 as there are breaking changes. You can continue to use the 0.7 branch as long as you like. See the documentation for 0.7 [here](https://github.com/andris9/Nodemailer/blob/0.7/README.md).\r\n\r\n### Migration guide\r\n\r\nSee the migration guide from 0.7 to 1.0 [in the 1.0 release blog post](http://www.andrisreinman.com/nodemailer-v1-0/#migrationguide).\r\n\r\n## Notes and information\r\n\r\n### Nodemailer supports\r\n\r\n * **Unicode** to use any characters\r\n * **Windows** – you can install it with *npm* on Windows just like any other module, there are no compiled dependencies. Use it from Azure or from your Windows box hassle free.\r\n * **HTML content** as well as **plain text** alternative\r\n * **Attachments** (including attachment **streaming** for sending larger files)\r\n * **Embedded images** in HTML\r\n * Secure e-mail delivery using **SSL/STARTTLS**\r\n * Different **transport methods**, either using built in transports or from external plugins\r\n * Custom **Plugin support** for manipulating messages (add DKIM signatures, use markdown content instead of HTML etc.)\r\n * Sane **XOAUTH2** login with automatic access token generation (and feedback about the updated tokens)\r\n\r\n### Support Nodemailer development\r\n\r\n[![Donate to author](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DB26KWR2BQX5W)\r\n\r\nIf you want to support with Bitcoins, then my wallet address is `15Z8ADxhssKUiwP3jbbqJwA21744KMCfTM`\r\n\r\n## TL;DR Usage Example\r\n\r\nThis is a complete example to send an e-mail with plaintext and HTML body\r\n\r\n```javascript\r\nvar nodemailer = require('nodemailer');\r\n\r\n// create reusable transporter object using SMTP transport\r\nvar transporter = nodemailer.createTransport({\r\n service: 'Gmail',\r\n auth: {\r\n user: 'gmail.user@gmail.com',\r\n pass: 'userpass'\r\n }\r\n});\r\n\r\n// NB! No need to recreate the transporter object. You can use\r\n// the same transporter object for all e-mails\r\n\r\n// setup e-mail data with unicode symbols\r\nvar mailOptions = {\r\n from: 'Fred Foo ✔ <foo@blurdybloop.com>', // sender address\r\n to: 'bar@blurdybloop.com, baz@blurdybloop.com', // list of receivers\r\n subject: 'Hello ✔', // Subject line\r\n text: 'Hello world ✔', // plaintext body\r\n html: '<b>Hello world ✔</b>' // html body\r\n};\r\n\r\n// send mail with defined transport object\r\ntransporter.sendMail(mailOptions, function(error, info){\r\n if(error){\r\n console.log(error);\r\n }else{\r\n console.log('Message sent: ' + info.response);\r\n }\r\n});\r\n```\r\n\r\nSee [nodemailer-smtp-transport](https://github.com/andris9/nodemailer-smtp-transport#usage) for SMTP configuration options and [nodemailer-wellknown](https://github.com/andris9/nodemailer-wellknown#supported-services) for preconfigured service names (example uses 'gmail').\r\n\r\n> When using default SMTP transport, then you do not need to define transport type explicitly (even though you can), just provide the SMTP options and that's it. For anything else, see the docs of the particular [transport mechanism](#available-transports).\r\n\r\n## Goals for 1.0\r\n\r\n### 1. Move optional features out of core\r\n\r\nNodemailer 0.x is quite large and includes a ton of stuff that is not needed for most users. Sometimes it causes problems, for example when\r\na feature that you do not even use requires some dependency to be installed that throws in your environment. If you only use SMTP to send e-mails you do not need the SES code and vice versa. The goal is achieved with a plugin system where you can install and load only these plugins that you actually require.\r\n\r\n### 2. Gigabyte attachments\r\n\r\nVersion 1.0 is a total rewrite from the ground up and relying heavily on Streams2. This allows you to reliably\r\nsend messages with gigabyte attachments even through a slow network connection without CPU or memory penalties. You probably never need it but it makes using smaller attachments more reliable as well.\r\n\r\n## Setting up\r\n\r\nInstall with npm\r\n\r\n npm install nodemailer\r\n\r\nTo send e-mails you need a transporter object\r\n\r\n```javascript\r\nvar transporter = nodemailer.createTransport(transport)\r\n```\r\n\r\nWhere\r\n\r\n * **transporter** is going to be an object that is able to send mail\r\n * **transport** is a transport mechanism. If it is not set [nodemailer-direct-transport](https://github.com/andris9/nodemailer-direct-transport) transport is used. If it is a regular object [nodemailer-smtp-transport](https://github.com/andris9/nodemailer-smtp-transport) is used and the value is passed as SMTP configuration.\r\n\r\n> You have to create the transporter object only once. If you already have a transporter object you can use it to send mail as much as you like.\r\n\r\n### Examples\r\n\r\n#### Use *direct* transport\r\n\r\nIn this case all e-mails are sent directly to the recipients MX server (using port 25)\r\n\r\n```javascript\r\nvar nodemailer = require('nodemailer');\r\nvar transporter = nodemailer.createTransport();\r\ntransporter.sendMail({\r\n from: 'sender@address',\r\n to: 'receiver@address',\r\n subject: 'hello',\r\n text: 'hello world!'\r\n});\r\n```\r\n\r\n> Using *direct* transport is not reliable as outgoing port 25 used is often blocked by default. Additionally mail sent from dynamic addresses is often flagged as spam. You should really consider using a SMTP provider.\r\n\r\n#### Use the default *SMTP* transport\r\n\r\nSee SMTP [configuration options here](https://github.com/andris9/nodemailer-smtp-transport#usage)\r\n\r\n```javascript\r\nvar nodemailer = require('nodemailer');\r\nvar transporter = nodemailer.createTransport({\r\n service: 'gmail',\r\n auth: {\r\n user: 'sender@gmail.com',\r\n pass: 'password'\r\n }\r\n});\r\ntransporter.sendMail({\r\n from: 'sender@address',\r\n to: 'receiver@address',\r\n subject: 'hello',\r\n text: 'hello world!'\r\n});\r\n```\r\n\r\n> Default SMTP transport is not suitable for large volume of e-mails new SMTP connection is established for every mail sent. Use [nodemailer-smtp-pool](https://github.com/andris9/nodemailer-smtp-pool) if you need to send a large amout of e-mails.\r\n>\r\n> For sending bulk mail using Nodemailer see the [recommendations below](#delivering-bulk-mail)\r\n\r\n#### Use a transport plugin\r\n\r\nSee [Available Transports](#available-transports) for known transport plugins but there might be non listed plugins as well.\r\n\r\nThe following example uses [nodemailer-ses-transport](https://github.com/andris9/nodemailer-ses-transport) (Amazon SES).\r\n\r\n```javascript\r\nvar nodemailer = require('nodemailer');\r\nvar ses = require('nodemailer-ses-transport');\r\nvar transporter = nodemailer.createTransport(ses({\r\n accessKeyId: 'AWSACCESSKEY',\r\n secretAccessKey: 'AWS/Secret/key'\r\n}));\r\ntransporter.sendMail({\r\n from: 'sender@address',\r\n to: 'receiver@address',\r\n subject: 'hello',\r\n text: 'hello world!'\r\n});\r\n```\r\n\r\n## Available Transports\r\n\r\n**Built in**\r\n\r\n * **[nodemailer-smtp-transport](https://github.com/andris9/nodemailer-smtp-transport)** for sending messages using a SMTP service\r\n * **[nodemailer-direct-transport](https://github.com/andris9/nodemailer-direct-transport)** for sending messages directly to recipients MX servers (zero configuration needed but unreliable)\r\n\r\n**Install as dependencies**\r\n\r\n * **[nodemailer-smtp-pool](https://github.com/andris9/nodemailer-smtp-pool)** for sending messages to SMTP using pooled connections\r\n * **[nodemailer-ses-transport](https://github.com/andris9/nodemailer-ses-transport)** for sending messages to AWS SES\r\n * **[nodemailer-sendmail-transport](https://github.com/andris9/nodemailer-sendmail-transport)** for piping messages to the *sendmail* command\r\n * **[nodemailer-stub-transport](https://github.com/andris9/nodemailer-stub-transport)** is just for returning messages, most probably for testing purposes\r\n * **[nodemailer-pickup-transport](https://github.com/andris9/nodemailer-pickup-transport)** for storing messages to pickup folders\r\n * **[nodemailer-sendgrid-transport](https://github.com/sendgrid/nodemailer-sendgrid-transport)** for sending messages through SendGrid's Web API\r\n * *add yours* (see transport api documentation [here](#transports))\r\n\r\n## Available Plugins\r\n\r\n * **[nodemailer-markdown](https://github.com/andris9/nodemailer-markdown)** to use markdown for the content\r\n * **[nodemailer-dkim](https://github.com/andris9/nodemailer-dkim)** to sign messages with DKIM\r\n * **[nodemailer-html-to-text](https://github.com/andris9/nodemailer-html-to-text)** to auto generate plaintext content from html\r\n * **[nodemailer-express-handlebars](https://github.com/yads/nodemailer-express-handlebars)** to auto generate html emails from handelbars/mustache templates\r\n * *add yours* (see plugin api documentation [here](#plugin-api))\r\n\r\n## Sending mail\r\n\r\nOnce you have a transporter object you can send mail\r\n\r\n```javascript\r\ntransporter.sendMail(data, callback)\r\n```\r\n\r\nWhere\r\n\r\n * **data** defines the mail content (see [e-mail message fields](#e-mail-message-fields) below)\r\n * **callback** is an optional callback function to run once the message is delivered or it failed.\r\n * **err** is the error object if message failed\r\n * **info** includes the result, the exact format depends on the transport mechanism used\r\n * **info.messageId** most transports *should* return the final Message-Id value used with this property\r\n * **info.envelope** includes the envelope object for the message\r\n * **info.accepted** is an array returned by SMTP transports (includes recipient addresses that were accepted by the server)\r\n * **info.rejected** is an array returned by SMTP transports (includes recipient addresses that were rejected by the server)\r\n * **info.pending** is an array returned by Direct SMTP transport. Includes recipient addresses that were temporarily rejected together with the server response\r\n * **response** is a string returned by SMTP transports and includes the last SMTP response from the server\r\n\r\n> If the message includes several recipients then the message is considered sent if at least one recipient is accepted\r\n\r\n### E-mail message fields\r\n\r\nThe following are the possible fields of an e-mail message:\r\n\r\n - **from** - The e-mail address of the sender. All e-mail addresses can be plain `'sender@server.com'` or formatted `'Sender Name <sender@server.com>'`, see [here](#address-formatting) for details\r\n - **sender** - An e-mail address that will appear on the *Sender:* field\r\n - **to** - Comma separated list or an array of recipients e-mail addresses that will appear on the *To:* field\r\n - **cc** - Comma separated list or an array of recipients e-mail addresses that will appear on the *Cc:* field\r\n - **bcc** - Comma separated list or an array of recipients e-mail addresses that will appear on the *Bcc:* field\r\n - **replyTo** - An e-mail address that will appear on the *Reply-To:* field\r\n - **inReplyTo** - The message-id this message is replying\r\n - **references** - Message-id list (an array or space separated string)\r\n - **subject** - The subject of the e-mail\r\n - **text** - The plaintext version of the message as an Unicode string, Buffer, Stream or an object *{path: '...'}*\r\n - **html** - The HTML version of the message as an Unicode string, Buffer, Stream or an object *{path: '...'}*\r\n - **headers** - An object or array of additional header fields (e.g. *{\"X-Key-Name\": \"key value\"}* or *[{key: \"X-Key-Name\", value: \"val1\"}, {key: \"X-Key-Name\", value: \"val2\"}]*)\r\n - **attachments** - An array of attachment objects (see [below](#attachments) for details)\r\n - **alternatives** - An array of alternative text contents (in addition to text and html parts) (see [below](#alternatives) for details)\r\n - **envelope** - optional SMTP envelope, if auto generated envelope is not suitable (see [below](#smtp-envelope) for details)\r\n - **messageId** - optional Message-Id value, random value will be generated if not set\r\n - **date** - optional Date value, current UTC string will be used if not set\r\n - **encoding** - optional transfer encoding for the textual parts (defaults to 'quoted-printable')\r\n\r\nAll text fields (e-mail addresses, plaintext body, html body) use UTF-8 as the encoding.\r\nAttachments are streamed as binary.\r\n\r\n### Attachments\r\n\r\nAttachment object consists of the following properties:\r\n\r\n * **filename** - filename to be reported as the name of the attached file, use of unicode is allowed\r\n * **cid** - optional content id for using inline images in HTML message source\r\n * **content** - String, Buffer or a Stream contents for the attachment\r\n * **encoding** - If set and `content` is string, then encodes the content to a Buffer using the specified encoding. Example values: `base64`, `hex`, 'binary' etc. Useful if you want to use binary attachments in a JSON formatted e-mail object.\r\n * **path** - path to a file or an URL (data uris are allowed as well) if you want to stream the file instead of including it (better for larger attachments)\r\n * **contentType** - optional content type for the attachment, if not set will be derived from the `filename` property\r\n * **contentDisposition** - optional content disposition type for the attachment, defaults to 'attachment'\r\n\r\nAttachments can be added as many as you want.\r\n\r\n```javascript\r\nvar mailOptions = {\r\n ...\r\n attachments: [\r\n { // utf-8 string as an attachment\r\n filename: 'text1.txt',\r\n content: 'hello world!'\r\n },\r\n { // binary buffer as an attachment\r\n filename: 'text2.txt',\r\n content: new Buffer('hello world!','utf-8')\r\n },\r\n { // file on disk as an attachment\r\n filename: 'text3.txt',\r\n path: '/path/to/file.txt' // stream this file\r\n },\r\n { // filename and content type is derived from path\r\n path: '/path/to/file.txt'\r\n },\r\n { // stream as an attachment\r\n filename: 'text4.txt',\r\n content: fs.createReadStream('file.txt')\r\n },\r\n { // define custom content type for the attachment\r\n filename: 'text.bin',\r\n content: 'hello world!',\r\n contentType: 'text/plain'\r\n },\r\n { // use URL as an attachment\r\n filename: 'license.txt',\r\n path: 'https://raw.github.com/andris9/Nodemailer/master/LICENSE'\r\n },\r\n { // encoded string as an attachment\r\n filename: 'text1.txt',\r\n content: 'aGVsbG8gd29ybGQh',\r\n encoding: 'base64'\r\n },\r\n { // data uri as an attachment\r\n path: 'data:text/plain;base64,aGVsbG8gd29ybGQ='\r\n }\r\n ]\r\n}\r\n```\r\n\r\n### Alternatives\r\n\r\nIn addition to text and HTML, any kind of data can be inserted as an alternative content of the main body - for example a word processing document with the same text as in the HTML field. It is the job of the e-mail client to select and show the best fitting alternative to the reader. Usually this field is used for calendar events and such.\r\n\r\nAlternative objects use the same options as [attachment objects](#attachments). The difference between an attachment and an alternative is the fact that attachments are placed into *multipart/mixed* or *multipart/related* parts of the message white alternatives are placed into *multipart/alternative* part.\r\n\r\n**Usage example:**\r\n\r\n```javascript\r\nvar mailOptions = {\r\n ...\r\n html: '<b>Hello world!</b>',\r\n alternatives: [\r\n {\r\n contentType: 'text/x-web-markdown',\r\n content: '**Hello world!**'\r\n }\r\n ]\r\n}\r\n```\r\n\r\nAlternatives can be added as many as you want.\r\n\r\n### Address Formatting\r\n\r\nAll the e-mail addresses can be plain e-mail addresses\r\n\r\n```\r\nfoobar@blurdybloop.com\r\n```\r\n\r\nor with formatted name (includes unicode support)\r\n\r\n```\r\n\"Ноде Майлер\" <foobar@blurdybloop.com>\r\n```\r\n\r\nor as an address object\r\n\r\n```\r\n{\r\n name: 'Ноде Майлер',\r\n address: 'foobar@blurdybloop.com'\r\n}\r\n```\r\n\r\nTo, Cc and Bcc fields accept comma separated list of e-mails or an array of\r\ne-mails or an array of comma separated list of e-mails - use it as you like.\r\nFormatting can be mixed.\r\n\r\n```\r\n...,\r\nto: 'foobar@blurdybloop.com, \"Ноде Майлер\" <bar@blurdybloop.com>, \"Name, User\" <baz@blurdybloop.com>',\r\ncc: ['foobar@blurdybloop.com', '\"Ноде Майлер\" <bar@blurdybloop.com>, \"Name, User\" <baz@blurdybloop.com>']\r\n...\r\n```\r\n\r\nYou can even use unicode domains, these are automatically converted to punycode\r\n\r\n```\r\n'\"Unicode Domain\" <info@müriaad-polüteism.info>'\r\n```\r\n\r\n### SMTP envelope\r\n\r\nSMTP envelope is usually auto generated from `from`, `to`, `cc` and `bcc` fields but\r\nif for some reason you want to specify it yourself, you can do it with `envelope` property.\r\n\r\n`envelope` is an object with the following params: `from`, `to`, `cc` and `bcc` just like\r\nwith regular mail options. You can also use the regular address format, unicode domains etc.\r\n\r\n```javascript\r\nmailOptions = {\r\n ...,\r\n from: 'mailer@kreata.ee',\r\n to: 'daemon@kreata.ee',\r\n envelope: {\r\n from: 'Daemon <deamon@kreata.ee>',\r\n to: 'mailer@kreata.ee, Mailer <mailer2@kreata.ee>'\r\n }\r\n}\r\n```\r\n\r\n> Not all transports can use the `envelope` object, for example SES ignores it and uses the data from the From:, To: etc. headers.\r\n\r\n### Using Embedded Images\r\n\r\nAttachments can be used as embedded images in the HTML body. To use this feature, you need to set additional property of the attachment - `cid` (unique identifier of the file) which is a reference to the attachment file. The same `cid` value must be used as the image URL in HTML (using `cid:` as the URL protocol, see example below).\r\n\r\n**NB!** the cid value should be as unique as possible!\r\n\r\n```javascript\r\nvar mailOptions = {\r\n ...\r\n html: 'Embedded image: <img src=\"cid:unique@kreata.ee\"/>',\r\n attachments: [{\r\n filename: 'image.png',\r\n path: '/path/to/file',\r\n cid: 'unique@kreata.ee' //same cid value as in the html img src\r\n }]\r\n}\r\n```\r\n\r\n## Plugin system\r\n\r\nThere are 3 stages a plugin can hook to\r\n\r\n 1. **'compile'** is the step where e-mail data is set but nothing has been done with it yet. At this step you can modify mail options, for example modify `html` content, add new headers etc. Example: [nodemailer-markdown](https://github.com/andris9/nodemailer-markdown) that allows you to use `markdown` source instead of `text` and `html`.\r\n 2. **'stream'** is the step where message tree has been compiled and is ready to be streamed. At this step you can modify the generated MIME tree or add a transform stream that the generated raw e-mail will be piped through before passed to the transport object. Example: [nodemailer-dkim](https://github.com/andris9/nodemailer-dkim) that adds DKIM signature to the generated message.\r\n 3. **Transport** step where the raw e-mail is streamed to destination. Example: [nodemailer-smtp-transport](https://github.com/andris9/nodemailer-smtp-transport) that streams the message to a SMTP server.\r\n\r\n### Including plugins\r\n\r\n'compile' and 'stream' plugins can be attached with `use(plugin)` method\r\n\r\n```javascript\r\ntransporter.use(step, pluginFunc)\r\n```\r\n\r\nWhere\r\n\r\n * **transporter** is a transport object created with `createTransport`\r\n * **step** is a string, either 'compile' or 'stream' thatd defines when the plugin should be hooked\r\n * **pluginFunc** is a function that takes two arguments: the mail object and a callback function\r\n\r\n## Plugin API\r\n\r\nAll plugins (including transports) get two arguments, the mail object and a callback function.\r\n\r\nMail object that is passed to the plugin function as the first argument is an object with the following properties:\r\n\r\n * **data** is the mail data object that is passed to the `sendMail` method\r\n * **message** is the [BuildMail](https://github.com/andris9/buildmail) object of the message. This is available for the 'stream' step and for the transport but not for 'compile'.\r\n * **resolveContent** is a helper function for converting Nodemailer compatible stream objects into Strings or Buffers\r\n\r\n### resolveContent()\r\n\r\nIf your plugin needs to get the full value of a param, for example the String value for the `html` content, you can use `resolveContent()` to convert Nodemailer\r\ncompatible content objects to Strings or Buffers.\r\n\r\n```javascript\r\ndata.resolveContent(obj, key, callback)\r\n```\r\n\r\nWhere\r\n\r\n * **obj** is an object that has a property you want to convert to a String or a Buffer\r\n * **key** is the name of the property you want to convert\r\n * **callback** is the callback function with (err, value) where `value` is either a String or Buffer, depending on the input\r\n\r\n**Example**\r\n\r\n```javascript\r\nfunction plugin(mail, callback){\r\n // if mail.data.html is a file or an url, it is returned as a Buffer\r\n mail.resolveContent(mail.data, 'html', function(err, html){\r\n if(err){\r\n return callback(err);\r\n }\r\n console.log('HTML contents: %s', html.toString());\r\n callback();\r\n });\r\n};\r\n```\r\n\r\n### 'compile'\r\n\r\nCompile step plugins get only the `mail.data` object but not `mail.message` in the `mail` argument of the plugin function. If you need to access the `mail.message` as well use 'stream' step instead.\r\n\r\nThis is really straightforward, your plugin can modify the `mail.data` object at will and once everything is finished run the callback function. If the callback gets an error object as an argument, then the process is terminated and the error is returned to the `sendMail` callback.\r\n\r\n**Example**\r\n\r\nThe following plugin checks if `text` value is set and if not converts `html` value to `text` by removing all html tags.\r\n\r\n```javascript\r\ntransporter.use('compile', function(mail, callback){\r\n if(!mail.text && mail.html){\r\n mail.text = mail.html.replace(/<[^>]*>/g, ' ');\r\n }\r\n callback();\r\n});\r\n```\r\n\r\nSee [plugin-compile.js](examples/plugin-compile.js) for a working example.\r\n\r\n### 'stream'\r\n\r\nStreaming step is invoked once the message structure is built and ready to be streamed to the transport. Plugin function still gets `mail.data` but it is included just for the reference, modifying it should not change anything (unless the transport requires something from the `mail.data`, for example `mail.data.envelope`).\r\n\r\nYou can modify the `mail.message` object as you like, the message is not yet streaming anything (message starts streaming when the transport calls `mail.message.createReadStream()`).\r\n\r\nIn most cases you might be interested in the [message.transform()](https://github.com/andris9/buildmail#transform) method for applying transform streams to the raw message.\r\n\r\n**Example**\r\n\r\nThe following plugin replaces all tabs with spaces in the raw message.\r\n\r\n```javascript\r\nvar transformer = new (require('stream').Transform)();\r\ntransformer._transform = function(chunk, encoding, done) {\r\n // replace all tabs with spaces in the stream chunk\r\n for(var i = 0; i < chunk.length; i++){\r\n if(chunk[i] === 0x09){\r\n chunk[i] = 0x20;\r\n }\r\n }\r\n this.push(chunk);\r\n done();\r\n};\r\n\r\ntransporter.use('stream', function(mail, callback){\r\n // apply output transformer to the raw message stream\r\n mail.message.transform(transformer);\r\n callback();\r\n});\r\n```\r\n\r\nSee [plugin-stream.js](examples/plugin-stream.js) for a working example.\r\n\r\nAdditionally you might be interested in the [message.getAddresses()](https://github.com/andris9/buildmail#getaddresses) method that returns the contents for all address fields as structured objects.\r\n\r\n**Example**\r\n\r\nThe following plugin prints address information to console.\r\n\r\n```javascript\r\ntransporter.use('stream', function(mail, callback){\r\n var addresses = mail.message.getAddresses();\r\n console.log('From: %s', JSON.stringify(addresses.from));\r\n console.log('To: %s', JSON.stringify(addresses.to));\r\n console.log('Cc: %s', JSON.stringify(addresses.cc));\r\n console.log('Bcc: %s', JSON.stringify(addresses.bcc));\r\n callback();\r\n});\r\n```\r\n\r\n### Transports\r\n\r\nTransports are objects that have a method `send` and properies `name` and `version`. Additionally, if the transport object is an Event Emitter, 'log' events are piped through Nodemailer. A transport object is passed to the `nodemailer.createTransport(transport)` method to create the transporter object.\r\n\r\n**`transport.name`**\r\n\r\nThis is the name of the transport object. For example 'SMTP' or 'SES' etc.\r\n\r\n```javascript\r\ntransport.name = require('package.json').name;\r\n```\r\n\r\n**`transport.version`**\r\n\r\nThis should be the transport module version. For example '0.1.0'.\r\n\r\n```javascript\r\ntransport.version = require('package.json').version;\r\n```\r\n\r\n**`transport.send(mail, callback)`**\r\n\r\nThis is the method that actually sends out e-mails. The method is basically the same as 'stream' plugin functions. It gets two arguments: `mail` and a callback. To start streaming the message, create the stream with `mail.message.createReadStream()`\r\n\r\nCallback function should return an `info` object as the second arugment. This info object should contain `messageId` value with the Message-Id header (without the surrounding &lt; &gt; brackets)\r\n\r\nThe following example pipes the raw stream to the console.\r\n\r\n```javascript\r\ntransport.send = function(mail, callback){\r\n var input = mail.message.createReadStream();\r\n var messageId = (mail.message.getHeader('message-id') || '').replace(/[<>\\s]/g, '');\r\n input.pipe(process.stdout);\r\n input.on('end', function() {\r\n callback(null, {\r\n messageId: messageId\r\n });\r\n });\r\n};\r\n```\r\n\r\n**`transport.close(args*)`**\r\n\r\nIf your transport needs to be closed explicitly, you can implement a `close` method.\r\n\r\nThis is purely optional feature and only makes sense in special contexts (eg. closing a SMTP pool).\r\n\r\nOnce you have a transport object, you can create a mail transporter out of it.\r\n\r\n```\r\nvar nodemailer = require('nodemailer');\r\nvar transport = require('some-transport-method');\r\nvar transporter = nodemailer.createTransport(transport);\r\ntransporter.sendMail({mail data});\r\n```\r\n\r\nSee [minimal-transport.js](examples/minimal-transport.js) for a working example.\r\n\r\n## Using Gmail\r\n\r\nEven though Gmail is the fastest way to get started with sending emails, it is by no means a preferable solution unless you are using OAuth2 authentication. Gmail expects the user to be an actual user not a robot so it runs a lot of heuristics for every login attempt and blocks anything that looks suspicious to defend the user from account hijacking attempts. For example you might run into trouble if your server is in another geographical location – everything works in your dev machine but messages are blocked in production.\r\n\r\nAdditionally Gmail has came up with the concept of ['less secure'](https://support.google.com/accounts/answer/6010255?hl=en) apps which is basically anyone who uses plain password to login to Gmail, so you might end up in a situation where one username can send (support for 'less secure' apps is enabled) but other is blocked (support for 'less secure' apps is disabled).\r\n\r\nTo prevent having login issues you should either use XOAUTH2 (see details [here](https://github.com/andris9/nodemailer-smtp-transport#authentication)) or use another provider and preferably a dedicated one like [Mailgun](http://www.mailgun.com/) or [SendGrid](http://mbsy.co/sendgrid/12237825) or any other. Usually these providers have free plans available that are compareable to the daily sending limits of Gmail. Gmail has a limit of 500 recipients a day (a message with one *To* and one *Cc* address counts as two messages since it has two recipients) for @gmail.com addresses and 2000 for Google Apps customers, larger SMTP providers usually offer about 200-300 recipients a day for free.\r\n\r\n## Delivering Bulk Mail\r\n\r\nHere are some tips how to handle bulk mail, for example if you need to send 10 million messages at once (originally published as a [blog post](http://www.andrisreinman.com/delivering-bulk-mail-with-nodemailer/)).\r\n\r\n 1. **Use a dedicated SMTP provider** like [SendGrid](http://mbsy.co/sendgrid/12237825) or [Mailgun](http://www.mailgun.com/) or any other. Do not use services that offer SMTP as a sideline or for free (thats Gmail or the SMTP of your homepage hosting company) to send bulk mail – you'll hit all the hard limits immediatelly or get labelled as spam. Basically you get what you pay for and if you pay zero then your deliverability is near zero as well. E-mail might seem free but it is only free to a certain amount and that amount certainly does not include 10 million e-mails in a short period of time.\r\n 2. **Use a dedicated queue manager,** for example [RabbitMQ](http://www.rabbitmq.com/) for queueing the e-mails. Nodemailer creates a callback function with related scopes etc. for every message so it might be hard on memory if you pile up the data for 10 million messages at once. Better to take the data from a queue when there's a free spot in the connection pool (previously sent message returns its callback).\r\n 3. **Use [nodemailer-smtp-pool](https://github.com/andris9/nodemailer-smtp-pool) transport.** You do not want to have the overhead of creating a new connection and doing the SMTP handshake dance for every single e-mail. Pooled connections make it possible to bring this overhead to a minimum.\r\n 4. **Set `maxMessages` option to `Infinity`** for the nodemailer-smtp-pool transport. Dedicated SMTP providers happily accept all your e-mails as long you are paying for these, so no need to disconnect in the middle if everything is going smoothly. The default value is 100 which means that once a connection is used to send 100 messages it is removed from the pool and a new connection is created.\r\n 5. **Set `maxConnections` to whatever your system can handle.** There might be limits to this on the receiving side, so do not set it to `Infinity`, even 20 is probably much better than the default 5. A larger number means a larger amount of messages are sent in parallel.\r\n 6. **Use file paths not URLs for attachments.** If you are reading the same file from the disk several million times, the contents for the file probably get cached somewhere between your app and the physical hard disk, so you get your files back quicker (assuming you send the same attachment to all recipients). There is nothing like this for URLs – every new message makes a fresh HTTP fetch to receive the file from the server.\r\n 7. If the SMTP service accepts HTTP API as well you still might prefer SMTP and not the HTTP API as HTTP introduces additional overhead. You probably want to use HTTP over SMTP if the HTTP API is bulk aware – you send a message template and the list of 10 million recipients and the service compiles this information into e-mails itself, you can't beat this with SMTP.\r\n\r\n\r\n## License\r\n\r\n**Nodemailer** is licensed under [MIT license](https://github.com/andris9/Nodemailer/blob/master/LICENSE). Basically you can do whatever you want to with it\r\n\r\n----\r\n\r\nThe Nodemailer logo was designed by [Sven Kristjansen](https://www.behance.net/kristjansen).\r\n","google":"UA-51322-34","note":"Don't delete this file! It's used internally to help with page regeneration."}
140 stylesheets/pygment_trac.css
View
@@ -1,70 +1,70 @@
-.highlight .hll { background-color: #ffffcc }
-.highlight { background: #f0f3f3; }
-.highlight .c { color: #0099FF; font-style: italic } /* Comment */
-.highlight .err { color: #AA0000; background-color: #FFAAAA } /* Error */
-.highlight .k { color: #006699; font-weight: bold } /* Keyword */
-.highlight .o { color: #555555 } /* Operator */
-.highlight .cm { color: #0099FF; font-style: italic } /* Comment.Multiline */
-.highlight .cp { color: #009999 } /* Comment.Preproc */
-.highlight .c1 { color: #0099FF; font-style: italic } /* Comment.Single */
-.highlight .cs { color: #0099FF; font-weight: bold; font-style: italic } /* Comment.Special */
-.highlight .gd { background-color: #FFCCCC; border: 1px solid #CC0000 } /* Generic.Deleted */
-.highlight .ge { font-style: italic } /* Generic.Emph */
-.highlight .gr { color: #FF0000 } /* Generic.Error */
-.highlight .gh { color: #003300; font-weight: bold } /* Generic.Heading */
-.highlight .gi { background-color: #CCFFCC; border: 1px solid #00CC00 } /* Generic.Inserted */
-.highlight .go { color: #AAAAAA } /* Generic.Output */
-.highlight .gp { color: #000099; font-weight: bold } /* Generic.Prompt */
-.highlight .gs { font-weight: bold } /* Generic.Strong */
-.highlight .gu { color: #003300; font-weight: bold } /* Generic.Subheading */
-.highlight .gt { color: #99CC66 } /* Generic.Traceback */
-.highlight .kc { color: #006699; font-weight: bold } /* Keyword.Constant */
-.highlight .kd { color: #006699; font-weight: bold } /* Keyword.Declaration */
-.highlight .kn { color: #006699; font-weight: bold } /* Keyword.Namespace */
-.highlight .kp { color: #006699 } /* Keyword.Pseudo */
-.highlight .kr { color: #006699; font-weight: bold } /* Keyword.Reserved */
-.highlight .kt { color: #007788; font-weight: bold } /* Keyword.Type */
-.highlight .m { color: #FF6600 } /* Literal.Number */
-.highlight .s { color: #CC3300 } /* Literal.String */
-.highlight .na { color: #330099 } /* Name.Attribute */
-.highlight .nb { color: #336666 } /* Name.Builtin */
-.highlight .nc { color: #00AA88; font-weight: bold } /* Name.Class */
-.highlight .no { color: #336600 } /* Name.Constant */
-.highlight .nd { color: #9999FF } /* Name.Decorator */
-.highlight .ni { color: #999999; font-weight: bold } /* Name.Entity */
-.highlight .ne { color: #CC0000; font-weight: bold } /* Name.Exception */
-.highlight .nf { color: #CC00FF } /* Name.Function */
-.highlight .nl { color: #9999FF } /* Name.Label */
-.highlight .nn { color: #00CCFF; font-weight: bold } /* Name.Namespace */
-.highlight .nt { color: #330099; font-weight: bold } /* Name.Tag */
-.highlight .nv { color: #003333 } /* Name.Variable */
-.highlight .ow { color: #000000; font-weight: bold } /* Operator.Word */
-.highlight .w { color: #bbbbbb } /* Text.Whitespace */
-.highlight .mf { color: #FF6600 } /* Literal.Number.Float */
-.highlight .mh { color: #FF6600 } /* Literal.Number.Hex */
-.highlight .mi { color: #FF6600 } /* Literal.Number.Integer */
-.highlight .mo { color: #FF6600 } /* Literal.Number.Oct */
-.highlight .sb { color: #CC3300 } /* Literal.String.Backtick */
-.highlight .sc { color: #CC3300 } /* Literal.String.Char */
-.highlight .sd { color: #CC3300; font-style: italic } /* Literal.String.Doc */
-.highlight .s2 { color: #CC3300 } /* Literal.String.Double */
-.highlight .se { color: #CC3300; font-weight: bold } /* Literal.String.Escape */
-.highlight .sh { color: #CC3300 } /* Literal.String.Heredoc */
-.highlight .si { color: #AA0000 } /* Literal.String.Interpol */
-.highlight .sx { color: #CC3300 } /* Literal.String.Other */
-.highlight .sr { color: #33AAAA } /* Literal.String.Regex */
-.highlight .s1 { color: #CC3300 } /* Literal.String.Single */
-.highlight .ss { color: #FFCC33 } /* Literal.String.Symbol */
-.highlight .bp { color: #336666 } /* Name.Builtin.Pseudo */
-.highlight .vc { color: #003333 } /* Name.Variable.Class */
-.highlight .vg { color: #003333 } /* Name.Variable.Global */
-.highlight .vi { color: #003333 } /* Name.Variable.Instance */
-.highlight .il { color: #FF6600 } /* Literal.Number.Integer.Long */
-
-.type-csharp .highlight .k { color: #0000FF }
-.type-csharp .highlight .kt { color: #0000FF }
-.type-csharp .highlight .nf { color: #000000; font-weight: normal }
-.type-csharp .highlight .nc { color: #2B91AF }
-.type-csharp .highlight .nn { color: #000000 }
-.type-csharp .highlight .s { color: #A31515 }
-.type-csharp .highlight .sc { color: #A31515 }
+.highlight .hll { background-color: #404040 }
+.highlight { color: #d0d0d0 }
+.highlight .c { color: #999999; font-style: italic } /* Comment */
+.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
+.highlight .g { color: #d0d0d0 } /* Generic */
+.highlight .k { color: #6ab825; font-weight: normal } /* Keyword */
+.highlight .l { color: #d0d0d0 } /* Literal */
+.highlight .n { color: #d0d0d0 } /* Name */
+.highlight .o { color: #d0d0d0 } /* Operator */
+.highlight .x { color: #d0d0d0 } /* Other */
+.highlight .p { color: #d0d0d0 } /* Punctuation */
+.highlight .cm { color: #999999; font-style: italic } /* Comment.Multiline */
+.highlight .cp { color: #cd2828; font-weight: normal } /* Comment.Preproc */
+.highlight .c1 { color: #999999; font-style: italic } /* Comment.Single */
+.highlight .cs { color: #e50808; font-weight: normal; background-color: #520000 } /* Comment.Special */
+.highlight .gd { color: #d22323 } /* Generic.Deleted */
+.highlight .ge { color: #d0d0d0; font-style: italic } /* Generic.Emph */
+.highlight .gr { color: #d22323 } /* Generic.Error */
+.highlight .gh { color: #ffffff; font-weight: normal } /* Generic.Heading */
+.highlight .gi { color: #589819 } /* Generic.Inserted */
+.highlight .go { color: #cccccc } /* Generic.Output */
+.highlight .gp { color: #aaaaaa } /* Generic.Prompt */
+.highlight .gs { color: #d0d0d0; font-weight: normal } /* Generic.Strong */
+.highlight .gu { color: #ffffff; text-decoration: underline } /* Generic.Subheading */
+.highlight .gt { color: #d22323 } /* Generic.Traceback */
+.highlight .kc { color: #6ab825; font-weight: normal } /* Keyword.Constant */
+.highlight .kd { color: #6ab825; font-weight: normal } /* Keyword.Declaration */
+.highlight .kn { color: #6ab825; font-weight: normal } /* Keyword.Namespace */
+.highlight .kp { color: #6ab825 } /* Keyword.Pseudo */
+.highlight .kr { color: #6ab825; font-weight: normal } /* Keyword.Reserved */
+.highlight .kt { color: #6ab825; font-weight: normal } /* Keyword.Type */
+.highlight .ld { color: #d0d0d0 } /* Literal.Date */
+.highlight .m { color: #3677a9 } /* Literal.Number */
+.highlight .s { color: #ff8 } /* Literal.String */
+.highlight .na { color: #bbbbbb } /* Name.Attribute */
+.highlight .nb { color: #24909d } /* Name.Builtin */
+.highlight .nc { color: #447fcf; text-decoration: underline } /* Name.Class */
+.highlight .no { color: #40ffff } /* Name.Constant */
+.highlight .nd { color: #ffa500 } /* Name.Decorator */
+.highlight .ni { color: #d0d0d0 } /* Name.Entity */
+.highlight .ne { color: #bbbbbb } /* Name.Exception */
+.highlight .nf { color: #447fcf } /* Name.Function */
+.highlight .nl { color: #d0d0d0 } /* Name.Label */
+.highlight .nn { color: #447fcf; text-decoration: underline } /* Name.Namespace */
+.highlight .nx { color: #d0d0d0 } /* Name.Other */
+.highlight .py { color: #d0d0d0 } /* Name.Property */
+.highlight .nt { color: #6ab825;} /* Name.Tag */
+.highlight .nv { color: #40ffff } /* Name.Variable */
+.highlight .ow { color: #6ab825; font-weight: normal } /* Operator.Word */
+.highlight .w { color: #666666 } /* Text.Whitespace */
+.highlight .mf { color: #3677a9 } /* Literal.Number.Float */
+.highlight .mh { color: #3677a9 } /* Literal.Number.Hex */
+.highlight .mi { color: #3677a9 } /* Literal.Number.Integer */
+.highlight .mo { color: #3677a9 } /* Literal.Number.Oct */
+.highlight .sb { color: #ff8 } /* Literal.String.Backtick */
+.highlight .sc { color: #ff8 } /* Literal.String.Char */
+.highlight .sd { color: #ff8 } /* Literal.String.Doc */
+.highlight .s2 { color: #ff8 } /* Literal.String.Double */
+.highlight .se { color: #ff8 } /* Literal.String.Escape */
+.highlight .sh { color: #ff8 } /* Literal.String.Heredoc */
+.highlight .si { color: #ff8 } /* Literal.String.Interpol */
+.highlight .sx { color: #ffa500 } /* Literal.String.Other */
+.highlight .sr { color: #ff8 } /* Literal.String.Regex */
+.highlight .s1 { color: #ff8 } /* Literal.String.Single */
+.highlight .ss { color: #ff8 } /* Literal.String.Symbol */
+.highlight .bp { color: #24909d } /* Name.Builtin.Pseudo */
+.highlight .vc { color: #40ffff } /* Name.Variable.Class */
+.highlight .vg { color: #40ffff } /* Name.Variable.Global */
+.highlight .vi { color: #40ffff } /* Name.Variable.Instance */
+.highlight .il { color: #3677a9 } /* Literal.Number.Integer.Long */
Please sign in to comment.
Something went wrong with that request. Please try again.