Im sending a password reset email and as its content im rendering html. In my backend (node) I use path to get the relative path so I can add an image but its not being displayed. Only when I host the image somewhere, I can add it to my html. otherwise if its in my project only and im using relative ath, no image is displayed in the email. What am I doing wrong? Thanks!!
folder structure: resources/logo.png resources/email.js
resources/email.js
const path = require('path');
const logoPath = path.join(__dirname, '..', 'logo.png');
const resetPwdEmail= (link, resetPasswordToken) => {
return (
`
<!DOCTYPE html>
<html>
<head>
<style>...</style>
</head>
<body>
<div>
<img src=${}/>
<a class="link" href=${link}/${resetPasswordToken}>reset password</a>
<p>...</p>
</div>
</body>
</html>
`
)
};
module.exports = {resetPwdEmail};
services/index.js
...
const apiInstance = new SibApiV3Sdk.TransactionalEmailsApi();
const sendSmtpEmail = {
sender: {
email: 'from@email.de'
},
to: [{
email: 'to@yahoo.com'
}],
subject: 'hello',
htmlContent: resetPwdEmail(link, resetPasswordToken, logoPath),
};
...