Hey there!
I am using Sendgrid to setup emails on a custom domain and Inbound Parse Webhook keeps getting in a loop and sending all the emails out multiple times and it won’t stop!
Here’s the config:
And the code:
app.post("/incomingmail",(req,res)=>{
var from = req.body.from;
var text = req.body.text;
var subject = req.body.subject;
var num_attachments = req.body.attachments;
var i
for (i = 1; i <= num_attachments; i++){
var attachment = req.files['attachment' + i];
// attachment will be a File object
}
console.log(req.body)
async function main(){
let transporter = nodemailer.createTransport({
host: 'smtp.sendgrid.net',
port: 587,
secure: false,
ignoreTLS: true,
auth: {
user: "apikey",
pass: process.env.EMAILPASS
}
});
// send mail with defined transport object
let info = await transporter.sendMail({
from: 'My Email <emailredacted@mydomain.com>',
replyTo: from,// sender address
to: "contact@eddiestech.co.uk",
subject: subject+" | New Contact Message", // Subject line
html: text
});
}
main().catch(console.error);
Anyone know what’s up here?