fix: wrap test email with standard email template (#252)
Use wrapEmailHtml() for the test email so it matches the look of all other emails sent by the platform (logo, footer, etc.). Co-authored-by: Paul Nothaft <[email protected]>
This commit is contained in:
co-authored by
Paul Nothaft
parent
ee46088985
commit
954a0118ba
@@ -160,12 +160,9 @@ router.post('/test', adminAuth, requirePermission('email.send'), async (req, res
|
|||||||
|
|
||||||
const transporter = nodemailer.createTransport(transportConfig);
|
const transporter = nodemailer.createTransport(transportConfig);
|
||||||
|
|
||||||
// Send test email
|
// Send test email with the same wrapper used for all other emails
|
||||||
await transporter.sendMail({
|
const subject = 'Test Email - Photo Sharing Platform';
|
||||||
from: `${config.from_name} <${config.from_email}>`,
|
const testHtmlBody = `
|
||||||
to: test_email,
|
|
||||||
subject: 'Test Email - Photo Sharing Platform',
|
|
||||||
html: `
|
|
||||||
<h2>Test Email Successful!</h2>
|
<h2>Test Email Successful!</h2>
|
||||||
<p>This is a test email from your Photo Sharing platform.</p>
|
<p>This is a test email from your Photo Sharing platform.</p>
|
||||||
<p>If you're seeing this, your email configuration is working correctly.</p>
|
<p>If you're seeing this, your email configuration is working correctly.</p>
|
||||||
@@ -175,7 +172,14 @@ router.post('/test', adminAuth, requirePermission('email.send'), async (req, res
|
|||||||
SMTP Host: ${config.smtp_host}<br>
|
SMTP Host: ${config.smtp_host}<br>
|
||||||
Time: ${new Date().toISOString()}
|
Time: ${new Date().toISOString()}
|
||||||
</p>
|
</p>
|
||||||
`,
|
`;
|
||||||
|
const wrappedHtml = await wrapEmailHtml(testHtmlBody, subject);
|
||||||
|
|
||||||
|
await transporter.sendMail({
|
||||||
|
from: `${config.from_name} <${config.from_email}>`,
|
||||||
|
to: test_email,
|
||||||
|
subject,
|
||||||
|
html: wrappedHtml,
|
||||||
text: 'Test Email Successful! Your email configuration is working correctly.'
|
text: 'Test Email Successful! Your email configuration is working correctly.'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user