mirror of
				https://github.com/nodemailer/wildduck.git
				synced 2025-10-31 16:49:19 +08:00 
			
		
		
		
	updated sample email
This commit is contained in:
		
							parent
							
								
									2f516612ea
								
							
						
					
					
						commit
						aa847860a9
					
				
					 2 changed files with 14 additions and 4 deletions
				
			
		|  | @ -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;"> |                                 <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;"> |                                     <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"> |                                         <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> |                                         </td> | ||||||
|                                     </tr> |                                     </tr> | ||||||
|                                     <tr 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"> |                                         <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> |                                         </td> | ||||||
|                                     </tr> |                                     </tr> | ||||||
| 
 | 
 | ||||||
|                                     <tr 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"> |                                         <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> |                                         </td> | ||||||
|                                     </tr> |                                     </tr> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								lib/tools.js
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								lib/tools.js
									
										
									
									
									
								
							|  | @ -1,5 +1,6 @@ | ||||||
| 'use strict'; | 'use strict'; | ||||||
| 
 | 
 | ||||||
|  | const os = require('os'); | ||||||
| const punycode = require('punycode'); | const punycode = require('punycode'); | ||||||
| const libmime = require('libmime'); | const libmime = require('libmime'); | ||||||
| const consts = require('./consts'); | const consts = require('./consts'); | ||||||
|  | @ -165,6 +166,11 @@ function getMailboxCounter(db, mailbox, type, done) { | ||||||
| function renderEmailTemplate(tags, template) { | function renderEmailTemplate(tags, template) { | ||||||
|     let result = JSON.parse(JSON.stringify(template)); |     let result = JSON.parse(JSON.stringify(template)); | ||||||
| 
 | 
 | ||||||
|  |     let specialTags = { | ||||||
|  |         TIMESTAMP: Date.now(), | ||||||
|  |         HOSTNAME: tags.DOMAIN || os.hostname() | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|     let walk = (node, nodeKey) => { |     let walk = (node, nodeKey) => { | ||||||
|         if (!node) { |         if (!node) { | ||||||
|             return; |             return; | ||||||
|  | @ -188,6 +194,8 @@ function renderEmailTemplate(tags, template) { | ||||||
|                 node[key] = node[key].replace(/\[([^\]]+)\]/g, (match, tag) => { |                 node[key] = node[key].replace(/\[([^\]]+)\]/g, (match, tag) => { | ||||||
|                     if (tag in tags) { |                     if (tag in tags) { | ||||||
|                         return isHTML ? he.encode(tags[tag]) : tags[tag]; |                         return isHTML ? he.encode(tags[tag]) : tags[tag]; | ||||||
|  |                     } else if (tag in specialTags) { | ||||||
|  |                         return isHTML ? he.encode((specialTags[tag] || '').toString()) : specialTags[tag]; | ||||||
|                     } |                     } | ||||||
|                     return match; |                     return match; | ||||||
|                 }); |                 }); | ||||||
|  | @ -245,7 +253,7 @@ function getEmailTemplates(tags, callback) { | ||||||
|                                         entry.message.html = entry.message.html.replace( |                                         entry.message.html = entry.message.html.replace( | ||||||
|                                             new RegExp('(["\'])(?:.\\/)?(?:' + name + '.)?' + fname + '(?=["\'])', 'g'), |                                             new RegExp('(["\'])(?:.\\/)?(?:' + name + '.)?' + fname + '(?=["\'])', 'g'), | ||||||
|                                             (m, p) => { |                                             (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; |                                                 return p + 'cid:' + attachment.cid; | ||||||
|                                             } |                                             } | ||||||
|                                         ); |                                         ); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue