0
votes

I'm trying to setup a simple contact form using nodemailer. All i'm trying to do is send an email to my email from the contact form. My email is "[email protected]"

When I do my axios post I get an error in the data object saying: 550 5.7.0 From address is not one of your addresses. but yet the status:200 and statusText:"OK"

When I use the same from email as the icloud email "[email protected]" then it works ? I dont see anything where it says you have to use the same from address as the service address ?

Axios post:

  const request = axios.post('http://localhost:3002/send', {'name':John Doe,'email':[email protected]'});
  request.then((result)=>{
      console.log("request = ", result);
  }); 

Error message from console.log("request = ", result);

error:{
 code:"EMESSAGE",
 command:"DATA",
 response:"550 5.7.0 From address is not one of your addresses.",
 responseCode:550
}

nodemailer is my node.js

const transporter = nodemailer.createTransport({
  service: "iCloud",
  auth: {
    user: "[email protected]",
    pass: "myemailpassword"
  }
})

    app.use('/send', function(req, res){
      var message = {
        from: req.body.email,
        to: '[email protected]',
        subject: 'Message From Portfolio Contact Form',
        //text: 'Plaintext version of the message',
        html: '<p>'+req.body.description+'</p>'
      };
      transporter.sendMail(message, function(error, info){
        if(error){
          res.json({error: error});
        }else{
          res.json({success: info.response});
        };
      });
    })
1

1 Answers

0
votes

You configure nodemailer transport with iCloud Service and you are trying to send a mail with a gmail adresse.

from: req.body.email, // [email protected]
to: '[email protected]'

Which logically produces the error:

response:"550 5.7.0 From address is not one of your addresses."

You probably want to do the inverse.