I am using smtp.js to send mails to my email id whose credentials i made using smtp.js.I made a contact form where i want the user to enter his info and email and that should be sent to my email.So according to this logic, my mail should be in To property and sender's mail should be in the From property.However, when i run the code, it throws an error as "Mailbox name not allowed. The server response was: Envelope FROM 'sendername@gmail.com' email address not allowed.". If not possible,can u tell me some other alternative using js.Thanks Code:
function sendmail()
{
var name = $('#name').val();
var email = $('#email').val();
var phone = $('#phone').val();
var address = $('#address').val();
var postal = $('#postal').val();
console.log(typeof(email))
// var body = $('#body').val();
var Body='Subject: '+"Estimated Quote"+'<br>Name: '+name+'<br>Email: '+email+'<br>Phone: '+phone+'<br>Address: '+address+'<br>Postal Code: '+postal+'<br>Quote exl VAT: '+vat_excl+'<br>Quote incl VAT: '+vat_incl;
//console.log(name, phone, email, message);
Email.send({
SecureToken:"2d019ac3-046b-4c4f-94e2-f4f3bf08fb1f",
To: 'receivermail@gmail.com',
From: email,
Subject: "New mail from "+name,
Body: Body
}).then(
message =>{
console.log (message);
if(message=='OK'){
alert('Thanks for submitting details.We will contact you soon.');
}
else{
console.error (message);
alert('Error submitting form.')
}