updated sample email

This commit is contained in:
Andris Reinman 2017-08-09 13:29:50 +03:00
parent 2f516612ea
commit aa847860a9
2 changed files with 14 additions and 4 deletions

View file

@ -87,18 +87,20 @@ body {
<table width="100%" cellpadding="0" cellspacing="0" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
[FNAME], welcome to Wild Duck email service!
<strong>[FNAME],</strong> welcome to Wild Duck email service!
</td>
</tr>
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
<img src="duck.png" />If you are seeing this message then it means you have reached the inbox of your new email address [EMAIL]. Be aware though that the service is in a constant change, so this address might disappear during the next database schema update. Don't start using it as your main email address!
<div style="float: left; margin: 0 20px 10px 0px;">
<img src="example.duck.png" />
</div>If you are seeing this message then it means you have reached the inbox of your new email address [EMAIL]. Be aware though that the service is in a constant change, so this address might disappear during the next database schema update. Don't start using it as your main email address!
</td>
</tr>
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
This message was generated and inserted to this mailbox from the <a href="https://github.com/nodemailer/wildduck/tree/master/emails">/emails</a> folder using the default template.
This message was generated and inserted to this mailbox from the <a href="https://github.com/nodemailer/wildduck/tree/master/emails">/emails</a> folder using the default template. Also note the duck image, it is included in the message as an embedded attachment.
</td>
</tr>

View file

@ -1,5 +1,6 @@
'use strict';
const os = require('os');
const punycode = require('punycode');
const libmime = require('libmime');
const consts = require('./consts');
@ -165,6 +166,11 @@ function getMailboxCounter(db, mailbox, type, done) {
function renderEmailTemplate(tags, template) {
let result = JSON.parse(JSON.stringify(template));
let specialTags = {
TIMESTAMP: Date.now(),
HOSTNAME: tags.DOMAIN || os.hostname()
};
let walk = (node, nodeKey) => {
if (!node) {
return;
@ -188,6 +194,8 @@ function renderEmailTemplate(tags, template) {
node[key] = node[key].replace(/\[([^\]]+)\]/g, (match, tag) => {
if (tag in tags) {
return isHTML ? he.encode(tags[tag]) : tags[tag];
} else if (tag in specialTags) {
return isHTML ? he.encode((specialTags[tag] || '').toString()) : specialTags[tag];
}
return match;
});
@ -245,7 +253,7 @@ function getEmailTemplates(tags, callback) {
entry.message.html = entry.message.html.replace(
new RegExp('(["\'])(?:.\\/)?(?:' + name + '.)?' + fname + '(?=["\'])', 'g'),
(m, p) => {
attachment.cid = attachment.cid || crypto.randomBytes(8).toString('hex') + '@wildduck.email';
attachment.cid = attachment.cid || crypto.randomBytes(8).toString('hex') + '-[TIMESTAMP]@[DOMAIN]';
return p + 'cid:' + attachment.cid;
}
);