Merge branch 'dev' into qa
This commit is contained in:
commit
2147963523
@ -51,6 +51,8 @@ export const sendEmailWithAttachment = onRequest({
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
const mailgun = new Mailgun(formData);
|
const mailgun = new Mailgun(formData);
|
||||||
const client = mailgun.client({ username: 'api', key: process.env.MAILGUN_API_KEY });
|
const client = mailgun.client({ username: 'api', key: process.env.MAILGUN_API_KEY });
|
||||||
|
|
||||||
@ -76,9 +78,12 @@ export const sendEmailWithAttachment = onRequest({
|
|||||||
|
|
||||||
const result = await client.messages.create(process.env.MAILGUN_SERVER, data);
|
const result = await client.messages.create(process.env.MAILGUN_SERVER, data);
|
||||||
fs.unlinkSync(tempFilePath);
|
fs.unlinkSync(tempFilePath);
|
||||||
|
|
||||||
logger.info('Email with attachment from URL sent successfully');
|
logger.info('Email with attachment from URL sent successfully');
|
||||||
response.json({ success: true, result });
|
response.json({ success: true, result });
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
console.error(`Error while sending E-mail. Error: ${e}`);
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error('Error sending email with attachment from URL:', error);
|
logger.error('Error sending email with attachment from URL:', error);
|
||||||
response.status(500).json({ success: false, error: error instanceof Error ? error.message : String(error) });
|
response.status(500).json({ success: false, error: error instanceof Error ? error.message : String(error) });
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user