From 50281d64bc337e8c564dc9514e9b6c35f43610c1 Mon Sep 17 00:00:00 2001 From: wanghaomei <86whm@163.com> Date: Tue, 2 Jul 2024 08:52:45 +0800 Subject: [PATCH] cc --- MailSend/SendMailJob.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/MailSend/SendMailJob.cs b/MailSend/SendMailJob.cs index 5a5dbde..0ea15db 100644 --- a/MailSend/SendMailJob.cs +++ b/MailSend/SendMailJob.cs @@ -141,6 +141,26 @@ namespace MailSend.Service message.To.Add(MailboxAddress.Parse(sendMail.SendTo)); } + if (!string.IsNullOrEmpty(sendMail.CCTo)) + { + if (sendMail.CCTo.IndexOf(";") > -1) + { + var arrCCTo = sendMail.CCTo.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); + foreach (var s in arrCCTo) + { + var trimStr = s.Trim(); + if (!string.IsNullOrEmpty(trimStr)) + { + message.Cc.Add(MailboxAddress.Parse(trimStr)); + } + } + } + else + { + message.To.Add(MailboxAddress.Parse(sendMail.CCTo)); + } + } + message.Subject = sendMail.Title; var html = new TextPart("html") {