英文:
how to include CC and BCC in email using Go
问题
如何在Go中的电子邮件功能中添加抄送(CC)和密送(BCC)?
以下是你的代码:
err := smtp.SendMail(
"smtp.zoho.com",
587,
config.Email_id,
config.Email_password,
[]string{email_to},
[]string{email_cc},
[]string{email_bcc},
[]byte(message),
)
在SendMail
函数中,你可以通过将抄送(CC)和密送(BCC)的电子邮件地址作为额外的参数传递给函数来添加抄送和密送功能。你可以将抄送地址放在[]string{email_cc}
中,将密送地址放在[]string{email_bcc}
中。
请确保在发送邮件之前,将email_cc
和email_bcc
替换为实际的抄送和密送电子邮件地址。
英文:
How to add CC and BCC on my email function in Go.
Here is my code
err := smtp.SendMail(
"smtp.zoho.com",
587,
config.Email_id,
config.Email_password,
[]string{email_to},
答案1
得分: 5
这取决于你使用的邮件库。简而言之,只需像处理其他标头(如“Subject:”或“To:”)一样,正常添加“Cc:”和“Bcc:”标头即可。
英文:
That depends on which mail library you're using. But the short version is: Just add the Cc:
and Bcc:
headers as usual, same as you do for any other header, such as Subject:
or To:
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论