Hi Am using node mailer to send mails.. It works fine with out attachment.But whenever i give some attachment it takes the default content 'data' as its content.. How should i avoid this..
My node mail function is looks like this...
function sendMail(toMailId, subject, body) {
for (var i = 0; i < 1; i++) {
email.send({
ssl: true,
host: DbConfig.mailConfig.host,
port: DbConfig.mailConfig.port,
domain: DbConfig.mailConfig.domain,
to: DbConfig.mailConfig.to,
from: DbConfig.mailConfig.from,
subject: subject,
reply_to: DbConfig.mailConfig.reply_to,
body: body,
authentication: DbConfig.mailConfig.authentication,
username: DbConfig.mailConfig.username,
password: DbConfig.mailConfig.password,
attachments: [
{
filename: "helloworld.txt",
content : 'data'
}
],
debug: DbConfig.mailConfig.debug
},
function (err, result) {
if (err) { console.log(err); }
});
}
}
My problem is when i open the attachment after mail receives in my inbox, it simply shows data in the body. other than that it displays nothing. when i remove content means it throws error..
My Json will look like this:
{
"mongodbUrl":"mongodb://USERID:PWD@localhost:27017/DBNAME",
"mailConfig" :{
"to":"someone@gmail.com",
"host": "smtp.gmail.com",
"port": 465,
"domain": "[127.0.0.1]",
"from":"sender@gmail.com" ,
"subject":"This is my mail subject,
"reply_to": "sender@gmail.com",
"authentication": "login",
"username": "sender@gmail.com",
"password": "pswd",
"debug": true
}
}
When i send PDF files means it is not opening.. When send text files means it is opening with the 'content data'.. how can handle this?