NodeJS SendGrid向多个收件人发送电子邮件时出现问题 [英] NodeJS Sendgrid Issue in sending email to multiple recipients

查看:11
本文介绍了NodeJS SendGrid向多个收件人发送电子邮件时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我向多个收件人发送邮件时遇到问题。

我的脚本是

var SendGrid = require('sendgrid').SendGrid;
var sendgrid = new SendGrid('<<username>>', '<<password>>');      
    sendgrid.send({
    to: 'nabababa@gmail.com',   
from: 'sengupta.nabarun@gmail.com',
bcc: ["sengupta.nabarun@gmail.com","sengupta_nabarun@rediffmail.com"],

我这里有两个问题

  1. 我可以在收件人列表中包含收件人数组吗?
  2. 如何获取密件抄送列表中的收件人数组?

与上述两个查询相关的解决方案确实会很有帮助

谢谢 纳巴伦

推荐答案

您可以在tobcc字段中使用收件人数组。

例如:

var SendGrid = require('sendgrid').SendGrid;
var sendgrid = new SendGrid('{{sendgrid username}}', '{{sendgrid password}}');      
sendgrid.send({
    to: ['one@example.com', 'two@example.com'],
    from: 'nick@sendgrid.com',
    bcc: ['three@example.com', 'four@example.com'],
    subject: 'This is a demonstration of SendGrid sending email to mulitple recipients.',
    html: '<img src="http://3.bp.blogspot.com/-P6jNF5dU_UI/TTgpp3K4vSI/AAAAAAAAD2I/V4JC33e6sPM/s1600/happy2.jpg" style="width: 100%" />'
});

如果这对您不起作用,并且Node没有发出任何错误,请登录SendGrid的网站并查看Email Activity Log,以查看电子邮件是否正在发送。

我在测试您的代码样本时遇到的一件事是,如果您将tobcc发送到同一个Gmail地址,Gmail会将它们合并到一封电子邮件中(因此它似乎不起作用)。确保在测试时向完全不同的帐户发送电子邮件。

如果您需要一些电子邮件帐户进行测试,Guerrilla Mail是创建临时测试帐户的绝佳选择。

这篇关于NodeJS SendGrid向多个收件人发送电子邮件时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆