我想从 R 向多个收件人发送一封邮件。我可以使用sendmail
功能来实现此功能,但是当收件人收到电子邮件时,他们只会在to
字段中看到他们的电子邮件地址。看起来 sendmail 在内部循环并向每个收件人发送单独的电子邮件,这不是真的carbon copy
。重要的是,每个收件人都可以看到针对其特定电子邮件的所有收件人(业务需求,因为他们需要回复此电子邮件的所有收件人)。如何使用 R 实现这一点?
我的代码
require(sendmailR)
to <- c("vasudeva.naik@abc.com")
header <- list(cc=c("alok.jadhav@abc.com"))
x <- sendmail("toto@abc.com", to, "test", "testing", header=header,control=list(smtpServer=server,verbose=TRUE))
<< 220 equity.xyz.com ESMTP Sendmail 8.11.7p1+Sun/8.11.7; Thu, 11 Jul 2013 21:31:43 -0400 (EDT)
>> HELO HKD03836654
<< 250 equity.xyz.com Hello HKD03836654.gbl.ad.net [169.34.175.142], pleased to meet you
>> MAIL FROM: toto@abc.com
<< 250 2.1.0 toto@abc.com... Sender ok
>> RCPT TO: vasudeva.naik@abc.com
<< 250 2.1.5 vasudeva.naik@abc.com... Recipient ok
>> DATA
<< 354 Enter mail, end with "." on a line by itself
>> <message data>
<< 250 2.0.0 r6C1Vh101169 Message accepted for delivery
>> QUIT
<< 221 2.0.0 equity.csfb.com closing connection
调试选项的输出。调试输出中不存在标头信息。
> sendmail("toto@abc.com", to, "test", "testing", header=header,control=list(smtpServer=server,transport="debug"))
From: toto@abc.com
To: vasudeva.naik@abc.com
Subject: test
Date: Mon, 15 Jul 2013 02:15:29 -0000
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="1a556aa6576e231876dabb67e5a4f58730d3a228654e14705503b6985a6a6707"
This is a message with multiple parts in MIME format.
--1a556aa6576e231876dabb67e5a4f58730d3a228654e14705503b6985a6a6707
Content-Type: text/plain; format=flowed
testing
--1a556aa6576e231876dabb67e5a4f58730d3a228654e14705503b6985a6a6707--
谢谢。