Why To email address blank while sending email by AWS pinpoint service? - node.js

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

Related

AWS Cognito ResendConfirmationCode not emailing code - Node / JS

I am using the AWS Cognito and trying to allow for users to resend the initial registration confirmation email (aka they register, and lose/forget/wait too long on the email verification link). When they register it sends the email no problem. When I use the code below for users that are registered and confirmed it works.
However, if i use below to try to resend that initial email confirmation link for a user that is not confirmed, it returns the right result but the email is never delivered. Can you please help with the right way to resend the initial email confirmation. Thanks!
{
"CodeDeliveryDetails": {
"AttributeName": "email",
"DeliveryMedium": "email",
"Destination": "the email address is here"
}
}
resendConfirmationCode(userName: string): Promise<any> {
return new Promise((resolve, reject) => {
const cognitoUser = this.getUserByUsername(userName);
cognitoUser.resendConfirmationCode((error: any, result: any) => {
if (error) {
reject(error);
} else {
resolve(result);
}
});
});
}

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 Email address is not verified. Gmail account

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:

Unable to send email using MailGun Node API

When trying to send a simple test message via mailgun using their Node api I don't get any errors, but I also am not receiving emails nor am I seeing any response in the mailgun logs.
Here is the code I am using ...
const mailgun = require('mailgun-js')({
apiKey: 'XXXXXXXXXX',
domain: 'https://api.mailgun.net/v3/XXXXXXXXX'
})
async function sendInvite() {
var email = process.argv[process.argv.length - 1]
const data = {
from: 'support#acme.com',
to: email,
subject: 'Welcome!',
html: '<p>Welcome!</p><p>You are very special!</p>'
}
return new Promise((resolve, reject) => {
mailgun.messages().send(data, (error, body) => {
if (error) {
console.error(error)
reject(error)
return
}
console.log(`Invite sent to ${email}`)
console.log(data)
console.log(body)
resolve();
})
})
}
sendInvite().then(() => console.log('Done')).catch((err) => console.error(err))
I discovered that the problem I had was in the format of the domain I was passing into mailgun.
Before I had the following :
const mailgun = require('mailgun-js')({
apiKey: 'XXXXXXXXXX',
domain: 'https://api.mailgun.net/v3/XXXXXXXXX'
})
The problem is that the value for domain should not include the https://api.mailgun.net/v3/ portion of the URL. Instead it should ONLY have your domain, e.g. mail.mydomain.com
Did you attach your credit card to mailGun account? Or if you just need to test your logic, in your account settings you should confirm any email address, which will get emails from mailgun
https://wordpress.org/support/topic/mailgun-http-api-test-failure-status-free-accounts-are-for-test-purposes-only/

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.

Resources