AWS-SES Email address is not verified. Gmail account - node.js

I have try to send email using AWS-SES when new customer registration.
But i got some error like this
Email address is not verified. The following identities failed the check in region US-EAST-1: mathuk22#gmail.com (Request ID: 2278b8eb-544e-11e9-bab8-536962476bb7)
Note: Am not verify mathuk22#gmail.com email id in my AWS-SES
Without verify email how can i send email ?
exports.emailSend = (req, res) =>{
var htmlContentData = req.body.htmlContentData; // html content
var htmlSubjectData = req.body.htmlSubjectData; // subject
var params = {
Destination: {
//BccAddresses: [],
//CcAddresses: [],
ToAddresses: ["mathuk22#gmail.com"]
},
Message: {
Body: {
Html: {
Charset: "UTF-8",
Data: htmlContentData // html mail content
},
Text: {
Charset: "UTF-8",
Data: "Hello Charith Sample description time 1517831318946"
}
},
Subject: {
Charset: "UTF-8",
Data: htmlSubjectData // html mail subject
}
},
ReplyToAddresses: [],
Source: "source#example.com",
};
ses.sendEmail(params, function(err, data) {
if (err)
console.log(err, err.stack);
else
res.send(data);
});
}

Initially AWS puts your account in Sandbox where you need to verify the recipient email address, you need to contact AWS Support and ask them to move your Account to production, once account is in production and limits have been increased, you don't need to verify recipient "To" address. It doesn't cause additional cost.
https://docs.aws.amazon.com/ses/latest/DeveloperGuide/request-production-access.html

Do the following steps to verify email on AWS:

Related

Why To email address blank while sending email by AWS pinpoint service?

I am using AWS Pintpoint service to send an email to user, I am sending email through the lambda file and email was sent successfully to user inbox. but the issue is to address is showing blank. below is the code which I am using in lambda.
const pinpointEmail = new AWS.PinpointEmail();
return pinpointEmail
.sendEmail({
FromEmailAddress: fromEmailAddress,
Destination: {
ToAddresses: ['nayakr.bikash#gmail.com'],
},
Content: {
Raw: { Data: mimeEmail.toString() },
},
})
.promise()
.then((data) => {
return data;
});
Gmail to address is blank
Any Help would be appreciate , why "to" address shown blank

how do i send emails using mail-gun in my express app

i new to mail-gun i'm trying to send an email after successful payment, but each time the payment is cofirmed , i don't get an email
this how i use it
const domain = 'https://app.mailgun.com/app/sending/domains/sandbox18d7fe3d7f4c6baf525.mailgun.org ';
var mailgun = require('mailgun-js')({
apiKey: "MY_APIKEY",
domain: domain
});
this is my email template
stripe.charges
.create(newCharge, function(err, charge) {
// send response
if (err) {
console.error(err);
res.json({ error: err, charge: false });
} else {
var emailTemplate = `Hello ${newCharge.shipping.name}, \n
Amount: ${newCharge.amount} \n
Thank you!`;
// compose email
var emailData = {
from: "no-reply#YOUR-DOMAIN.com",
to: req.body.email,
subject: "Bundle of Sticks Receipt - " + charge.id,
text: emailTemplate
};
// send email to customer
mailgun.messages().send(emailData);
emailData["to"] = "your_support_email#gmail.com";
emailData["subject"] = `New Order: Bundle of Sticks - ${charge.id}`;
// send email to supplier
mailgun.messages().send(emailData);
// send response with charge data
res.json({ error: false, charge: charge });
}
})
how can i go about this , the payment is always successful but the email dont go through
You should install nodemailer and nodemailer-mailgun-transport and work with those.
And using those it will work a little something like this:
import * as nodemailer from 'nodemailer';
import * as mailGun from 'nodemailer-mailgun-transport';
const auth = {
api_key: <YOUR_API_KEY>
domain: <YOUR_DOMAIN>,
}
const transporter = nodemailer.createTransport(mailGun(auth));
const mailOptions = {
sender: "John Doe",
from: email,
to: '<WHATEVER_EMEIL>',
subject: '<YOUR_SUBJECT>',
text: '<YOUR_TEXT>',
};
transporter.sendMail(mailOptions);
Just edit those to suit your need and variables, but that's generally the approach.

AWS SES Error: Email address is not verified

I am trying to send email using aws-sdk ses in nodejs.
While executing the code the response I am getting is:
message:
'Email address is not verified. The following identities failed the check in region US-EAST-1:xxxtestemailxxx#gmail.com',
code: 'MessageRejected'
I have already verified the sender as well as receiver email(destination email in a array).
On SES settings of aws console, it is showing the email is verified. I removed the email and then once again successfully verified it.
Last time(few months back) when I used it, everything was working fine.
Below is the screenshot of my aws console related to SES:
Also when I am sending the test email using aws console, its working fine. This is only happening when I am trying to send email using aws-sdk.
Does anyone knows what is wrong, just to be clear I am also posting the code below:
const send_email = function (email, subject, source, payload) {
console.log(email, subject, source, payload);
let email_param = {
Destination: {
ToAddresses: email
},
// ConfigurationSetName: 'XXXRANDOMTEXT_PLATFORM',
Message: {
Body: {
Html: {
Charset: "UTF-8",
Data: payload
}
// Text: {
// Charset: "UTF-8",
// Data: payload
// }
},
Subject: {
Charset: "UTF-8",
Data: subject
}
},
Source: source
};
let send_email = SES.sendEmail(email_param).promise();
send_email
.then(data => {
return true;
})
.catch(error => {
console.log('sending email error:', error);
return false
});
}
If your AWS account is still in the sandbox mode then you have to verify your sender, receiver etc. Go to the prod mod to have access to the full features.

AWS SES Nodejs SDK - email with dash bounces

I'm using the aws nodejs SES sdk and emails with to address with something like 'email#host-name.com' appear to all be bouncing even though they exist. Works for other emails without the dash.
I looked and the emails do look like they end up as query parameters, do I just need to individually url encode them? I dont get an error anymore, but I dont have any email address to test with.
var params = {
Destination: {
ToAddresses: [
'email#host-name.com'
]
},
Message: {
Body: {
Html: {
Data: body
}
},
Subject: {
Data: subject
}
},
Source: fromAddress
};
ses.sendEmail(params, function (err, data) {
if (err){
console.log(err, err.stack);
} else {
//sent
}
});
This ended up not having to do with the dash. The emails were bouncing because an AWS email service IP was blacklisted.

Sending emails using Mailgun with NodeMailer package

A couple of days ago I realized that Google has changed the security of gmail accounts, particularly for the possibility of sending emails from applications. After Googling around for a while I couldn't find a fix for it.
So, I resorted to using Mailgun. I created an account and had it enabled with Business verification. However, I still can't send emails. I keep getting an error about the requested URL not being found.
I am suspecting that since I haven't set up a domain yet, it is not picking the mailgun domain it provided by default. Could someone show me how to test sending emails using Mailgun from NodeMailer indicating the sandbox name provided by mailgun.
thanks in advance
José
var nodemailer = require('nodemailer');
// send mail with password confirmation
var transporter = nodemailer.createTransport( {
service: 'Mailgun',
auth: {
user: 'postmaster#sandboxXXXXXXXXXXXXXXXX.mailgun.org',
pass: 'XXXXXXXXXXXXXXXX'
}
});
var mailOpts = {
from: 'office#yourdomain.com',
to: 'user#gmail.com',
subject: 'test subject',
text : 'test message form mailgun',
html : '<b>test message form mailgun</b>'
};
transporter.sendMail(mailOpts, function (err, response) {
if (err) {
//ret.message = "Mail error.";
} else {
//ret.message = "Mail send.";
}
});
I created the Nodemailer transport for mailgun.
Here it how it works.
You install the package with npm install as you would do with any package, then in an empty file:
var nodemailer = require('nodemailer');
var mg = require('nodemailer-mailgun-transport');
// This is your API key that you retrieve from www.mailgun.com/cp (free up to 10K monthly emails)
var auth = {
auth: {
api_key: 'key-1234123412341234',
domain: 'sandbox3249234.mailgun.org'
}
}
var nodemailerMailgun = nodemailer.createTransport(mg(auth));
nodemailerMailgun.sendMail({
from: 'myemail#example.com',
to: 'recipient#domain.com', // An array if you have multiple recipients.
subject: 'Hey you, awesome!',
text: 'Mailgun rocks, pow pow!',
}, function (err, info) {
if (err) {
console.log('Error: ' + err);
}
else {
console.log('Response: ' + info);
}
});
Replace your API key with yours and change the details and you're ready to go!
It worked me, when I added the domain also to the auth object (not only the api_key). Like this:
var auth = {
auth: {
api_key: 'key-12319312391',
domain: 'sandbox3249234.mailgun.org'
}
};

Resources