I don't get emails when sending by Mandrill NodeJS API - node.js

I have this function below which allows me to send a mail with mandrill nodeJS API :
var mandrill = require('mandrill-api/mandrill');
var mandrill_client = new mandrill.Mandrill(config.values.mandrill_api_key);
exports.sendMail = function(htmlContent, textContent, subject, from_email, from_name, to_email, to_name ,reply_to_email, callback) {
var message = {
"html": htmlContent,
"text": textContent,
"subject": subject,
"from_email": from_email,
"from_name": from_name,
"to": [{
"email": to_email,
"name": to_name,
"type": "to"
}],
"headers": {
"Reply-To": reply_to_email
},
"important": false
};
var async = false;
mandrill_client.messages.send({"message": message, "async": async}, function(result) {
console.log(result);
callback(result);
}, function(e) {
console.log('A mandrill error occurred: ' + e.name + ' - ' + e.message);
});
};
On the mandrill console (https://mandrillapp.com/activity) I can see that emails have been successfully sent (status: Delivered).
But I don't get it in my gmail box nor hotmail box.
How to resolve this problem ?
Thanks,

Be sure, you're not using a testing API Key.
You can use a test key to experiment with Mandrill's API. No mail is actually sent, but webhooks trigger normally and you can generate synthetic bounces and complaints without impacting your reputation.

The problem is solved.
I had to add special fields into my DNS zone : DKIM and SPF
http://help.mandrill.com/entries/22030056-how-do-i-add-dns-records-for-my-sending-domains

Related

sending an email by using webmail through nodemailer

iam using nodemailer to sent an email but it only working for email not for gmail
// this is config connections
"nodemailer" : {
"host": "xxx.xxxxx.com",
"port": 587,
"secure":true,
"auth": {
"user": "myuser.com",
"pass": "password"
} ,
"tls": {
"rejectUnauthorized": false,
"minVersion": "TLSv1"
},
"debug":true,
"logger":true
},
"receivingEmail": {
"feedbackemail" : "abcd#gmailcom",
"contactemail" : "abcdef#gmail.com"
}
//nodemailer configurations
const transporter = nodemailer.createTransport((config["nodemailer"]));
var mailOptions = {
from: `${config["nodemailer"]["user"]}`,
to: tomail,
subject: subject ,
text: data
};
transporter.verify(function(error, success) {
if (error) {
console.log(error,"17");
} else {
console.log("Server is ready to take our messages");
}
});
transporter.sendMail(mailOptions, function(error, info){
if (error) {
console.log(error);
} else {
console.log('Email sent: ' + info.response);
}
});
here iam sending an email but couldn't able to send gmail accounts
Nodemailer 6.1.1 not working with NodeJs >=12
i tried this.. could you suggest me where is the mistake?
You need to make these changes to the gmail account to send an email. Go here and change it ON because Some apps and devices use less secure sign-in technology, which makes your account more vulnerable. You can turn off access for these apps, which we recommend, or turn on access if you want to use them despite the risks.
This thread have some options which you can try and might help if the above solution doesn't work.

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:

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.

Paypal single payout: TRANSACTION_LIMIT_EXCEEDED API Error

I'm trying to make a singe payout with the REST API of PayPal with Node.js and get this error:
//...
"errors": {
"name": "TRANSACTION_LIMIT_EXCEEDED",
"message": "Either the sender or receiver exceeded the transaction limit",
}
//...
What I do:
I use this example Code:
var paypal = require('paypal-rest-sdk');
module.exports = {
payMe: function (req, res,next) {
var mail = req.param('mail'); //this email comes from the paypal sandbox
paypal.configure({
'mode': 'sandbox',
'client_id': 'mycliendID',
'client_secret': 'myClientSecret'
});
var sender_batch_id = Math.random().toString(36).substring(9);
var create_payout_json = {
"sender_batch_header": {
"sender_batch_id": sender_batch_id,
"email_subject": "You have a payment"
},
"items": [
{
"recipient_type": "EMAIL",
"amount": {
"value": 0.90,
"currency": "CHF" //changed from Dollar to CHF
},
"receiver": mail,
"note": "Thank you.",
"sender_item_id": "item_3"
}
]
};
var sync_mode = 'true'; //for single payout
paypal.payout.create(create_payout_json, sync_mode, function (error, payout) {
if (error) {
console.log(error.response);
res.json(error.response);
throw error;
} else {
console.log("Create Single Payout Response");
console.log(payout);
payout.status= "You are in the else";
res.json(payout);
}
});
}
}
=>The Email-Address comes from my sandbox account - the Balance of this User is set to 900.00 CHF! (Much more than the 0.90 CHF which I want to payout)
=>I created under My Apps and Credentials a new REST API App and select the previous created User (with 900.00CHF balance). Those credentials are used in the above code snipped in paypal.configure()
"Either the sender or receiver exceeded the transaction limit"
Where can I change the transaction limit for the App and User in the sandbox?
OK Solved.
I logged in with the sandbox email address - there you can see all transactions.
Under "Denied" I saw the 0.90CHF - With a popup: "The receiver decided to deny the payment"
Then I realised that I used the same E-Mail Address for the Receiver and the Sender. That accused the Error. - The error-message is not very clear.
Maybe someone else is also doing the same mistake, so I let this here.

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