nodemailer

Nodemailer send base64 data URI as attachment. How?

点点圈 提交于 2020-05-27 00:21:43
问题 Basically I have an image created using Canvas and it's in base64 encoded data URI. This data URI is then attached to email. ..., attachments:[{ filename: "cat.jpg", contents: new Buffer(cat, 'base64') }], The email is received but the attachment is not viewable. Running $ file cat.jpg in linux returns: cat.jpg: ASCII text, with very long lines, with no line terminators Why is this ASCII? I had already mentioned base64. How may I fix this problem? Thank you. 回答1: The variable cat probably

nodemailer always sending the same response, res.send() not working

☆樱花仙子☆ 提交于 2020-05-17 07:01:46
问题 I'm trying to send a custom response if the email sending fails or succeeds... server router .post('/send-email', function (req, res) { let senderEmail = req.body.email; let message = req.body.message; let transporter = nodemailer.createTransport({ host: 'mail.domain.com', port: 25, secure: false, auth: { user: "contact@domain.com", pass: "password" }, tls: { secure: false, ignoreTLS: true, rejectUnauthorized: false } }); let mailOptions = { from: senderEmail, to: 'contact@domain.com',

Nodemailer and AWS SES EREFUSED error when using cloud functions

不打扰是莪最后的温柔 提交于 2020-04-30 19:28:48
问题 I'm building a web app with firebase and cloud functions. I have a cloud function that creates a verification code every time an new user wants to subscribe and I need to send via email this verification code. I'm trying to use nodemailer with AWS Simple Email Sender. I have my SMTP credentials for AWS SES and this code works perfectly on my localhost but when I deploy this cloud function to firebase I doesnt work and I get this error. { Error: queryA EREFUSED email-smtp.us-east-1.amazonaws

前后端登录注册之node剖析与token的使用状态

落花浮王杯 提交于 2020-04-24 09:23:21
登录模块功能详解   1、用户名密码的格式验证       由前端完成,根据需求自行决定,不加叙述       2、点击提交按钮思路详解        前端将用户名 以及加密后的密码还有验证码输入的内容统一发给后端 由后端和数据库的数据进行比对        将比对的结果返回给前端    3、密码加密及解密技术 使用插件包------jsencrypt 和 node-jsencrypt         这里我么利用了阿里的一个加密软件,此软件作用是生成两个不一样的key然后相当于一个键值对可以通过这两个key分别进行加密解密,        其中一个在前端使用加密另一个在后端解密,这样的话就会让安全性提高 具体代码如下         1 // 此模块是根据jsencrypt封装一个加密过程 2 3 import JSEncrypt from ' jsencrypt ' 4 5 export function jsEncrypt(str) { 6 // 实例这个方法 7 let encrypt = new JSEncrypt(); 8 // 根据一款软件 随机生成一段key值 这个key值是两个相互的 前后端各有一个 然后我们根据这个key值可以进行加密解密处理 9 let key =

535 Incorrect authentication error with nodemailer

♀尐吖头ヾ 提交于 2020-04-11 05:43:30
问题 Nodemailer is working and sending emails with these settings on localhost but these are not working on live server.Why it is happening? It always throw an error of incorrect authorization. I tried many solution but still i'm stuck with this issue. Where i'm doing mistake? Can anyone figure out this? Error: { Error: Invalid login: 535 Incorrect authentication data at SMTPConnection._formatError (/home/testing_node/public_html/testing_node/node_modules/nodemailer/lib/smtp-connection/index.js

What is the definitive way to use Gmail with OAuth and Nodemailer?

こ雲淡風輕ζ 提交于 2020-03-17 07:27:50
问题 Desired Behaviour Use Gmail , OAuth2 and Nodemailer to send an email from a server side node.js file. What I've Tried Relevant Documentation https://nodemailer.com/smtp/oauth2 https://nodemailer.com/usage/using-gmail https://developers.google.com/gmail/api/auth/web-server Relevant Questions send emails from MY gmail account with OAuth2 and nodemailer How do I authorise an app (web or installed) without user intervention? https://stackoverflow.com/a/47936349 https://stackoverflow.com/a

What is the definitive way to use Gmail with OAuth and Nodemailer?

这一生的挚爱 提交于 2020-03-17 07:27:27
问题 Desired Behaviour Use Gmail , OAuth2 and Nodemailer to send an email from a server side node.js file. What I've Tried Relevant Documentation https://nodemailer.com/smtp/oauth2 https://nodemailer.com/usage/using-gmail https://developers.google.com/gmail/api/auth/web-server Relevant Questions send emails from MY gmail account with OAuth2 and nodemailer How do I authorise an app (web or installed) without user intervention? https://stackoverflow.com/a/47936349 https://stackoverflow.com/a

Send Nodemailer e-mail with Namecheap email

南楼画角 提交于 2020-03-02 12:19:24
问题 I have been successful connecting a Gmail account with Xoauth, but I recently acquired a Namecheap privateemail account and can't for the life of me figure out how to set it up. This is the code that I have: var smtp = nodemailer.createTransport({ host: 'mail.privateemail.com', port: 25, auth: { user: 'contact@myemail.com', pass: 'mypassword' } }); I saw this question and tried all the other port numbers. 回答1: It may be secured connection in that case the port should be 465 465 port for SSL,

Send Nodemailer e-mail with Namecheap email

假装没事ソ 提交于 2020-03-02 12:18:11
问题 I have been successful connecting a Gmail account with Xoauth, but I recently acquired a Namecheap privateemail account and can't for the life of me figure out how to set it up. This is the code that I have: var smtp = nodemailer.createTransport({ host: 'mail.privateemail.com', port: 25, auth: { user: 'contact@myemail.com', pass: 'mypassword' } }); I saw this question and tried all the other port numbers. 回答1: It may be secured connection in that case the port should be 465 465 port for SSL,

Nodemailer got error: 'ECONNRESET' Code:'ESOCKET'

荒凉一梦 提交于 2020-02-25 06:20:45
问题 I tried to send mail using Nodemailer by using my mail server. It work fine in localhost:8000 buy when I deploy my project to production mode It's got error: 'ECONNRESET' fyi: I use express for the backend and deploy this project on window server 2012 This is an error error cannot sendmail: Error: read ECONNRESET at TCP.onStreamRead (internal/stream_base_commons.js:201:27) { errno: 'ECONNRESET', code: 'ESOCKET', syscall: 'read', command: 'CONN' Here is the code const nodemailer = require(