I have been trying to send email trough Mailtrap SMTP server but it does not send the email. I am using Nodemailer module in NodeJS application to send the email. The given SMTP information(Email Sending; not Email Testing) by Mailtrap is as below:
Following is the configuration set up as in the code:
const transporter = nodemailer.createTransport({
host: 'live.smtp.mailtrap.io',
port: '587',
secure: false,
requireTLS: true,
auth: {
user: 'api',
pass: '********cc8d'
}
})
const mailOptions = {
from: req.body.email,
to: '[email protected]',
subject: `Mssage from ${req.body.email}: ${req.body.subject}`,
text: req.body.message
}
transporter.sendMail(mailOptions, (error, info) => {
if (error) {
res.send('error');
} else {
res.send('success');
}
})
I could not find out the cause behind not sending the email. Ay solution or suggestion will be highly appreciated!

If you have a domain registered to Mailtrap, try to put an email from you domain in "from" field of mailOptions(even thought you don't have that email) because in some cases i faced a domain validation of the email sender.