This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import * as nodemailer from 'nodemailer';
|
||||
|
||||
export namespace MailService {
|
||||
const transporter = nodemailer.createTransport({
|
||||
host: process.env.EMAIL_HOST,
|
||||
pool: true,
|
||||
port: 465,
|
||||
secure: true,
|
||||
auth: {
|
||||
user: process.env.EMAIL_USERNAME,
|
||||
pass: process.env.EMAIL_PASSWORD
|
||||
}
|
||||
});
|
||||
|
||||
const mailConfigurations = {
|
||||
|
||||
// It should be a string of sender email
|
||||
from: 'noreply@nachklang.art',
|
||||
|
||||
// Comma Separated list of mails
|
||||
to: 'mail@pmueller.me',
|
||||
|
||||
// Subject of Email
|
||||
subject: '',
|
||||
|
||||
// This would be the text of email body
|
||||
text: ''
|
||||
};
|
||||
|
||||
export const sendMail = async (recipientAddress: string, subject: string, body: string) => {
|
||||
mailConfigurations.to = recipientAddress;
|
||||
mailConfigurations.subject = subject;
|
||||
mailConfigurations.text = body;
|
||||
|
||||
await transporter.sendMail(mailConfigurations);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user