mirror of
				https://github.com/strapi/strapi.git
				synced 2025-10-31 09:56:44 +00:00 
			
		
		
		
	 0f3f984ea7
			
		
	
	
		0f3f984ea7
		
	
	
	
	
		
			
			- Hooks registry - D&P CT migrations - i18N CT migrations - Umzug with js / sql migrations - Eslint updates
		
			
				
	
	
		
			41 lines
		
	
	
		
			925 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			925 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| 'use strict';
 | |
| 
 | |
| const sendmailFactory = require('sendmail');
 | |
| const { removeUndefined } = require('@strapi/utils');
 | |
| 
 | |
| module.exports = {
 | |
|   init(providerOptions = {}, settings = {}) {
 | |
|     const sendmail = sendmailFactory({
 | |
|       silent: true,
 | |
|       ...providerOptions,
 | |
|     });
 | |
|     return {
 | |
|       send(options) {
 | |
|         return new Promise((resolve, reject) => {
 | |
|           const { from, to, cc, bcc, replyTo, subject, text, html, ...rest } = options;
 | |
| 
 | |
|           let msg = {
 | |
|             from: from || settings.defaultFrom,
 | |
|             to,
 | |
|             cc,
 | |
|             bcc,
 | |
|             replyTo: replyTo || settings.defaultReplyTo,
 | |
|             subject,
 | |
|             text,
 | |
|             html,
 | |
|             ...rest,
 | |
|           };
 | |
| 
 | |
|           sendmail(removeUndefined(msg), err => {
 | |
|             if (err) {
 | |
|               reject(err);
 | |
|             } else {
 | |
|               resolve();
 | |
|             }
 | |
|           });
 | |
|         });
 | |
|       },
 | |
|     };
 | |
|   },
 | |
| };
 |