我正在使用下面的代碼來發送帶有文本文件的郵件作爲附件以及像這樣的文本文件的內容「License ADD LOGJz + RC- cVecSpK5-57AOrUlA-6aD3n5Fy-ejFGFIIa-XPU」將字符串列表寫入到文本文件中作爲附件添加到郵件中使用c#
public static bool sendMailFromToCCSubMsgAttachment(string fromName, string fromAdd, string toline, string subj, string htmlmsg, string cc, string strAttachment)
{
SmtpClient smtpClient = new SmtpClient(ConfigurationSettings.AppSettings["MAIL_SERVER"], Int32.Parse(ConfigurationSettings.AppSettings["SERVER_PORT"]));
MailMessage mail = new MailMessage();
if (!string.IsNullOrEmpty(strAttachment))
{
ContentType ct = new ContentType();
ct.MediaType = MediaTypeNames.Text.Plain;
Attachment attachFile = Attachment.CreateAttachmentFromString(strAttachment, ct);
mail.Attachments.Add(attachFile);
}
.........
.........
..........
}
在這裏,我們通過上面的內容‘strAttachment’變量這種方法 我現在正在傳遞的字符串列表的內容以文本文件和下面的內容格式..
License ADD 2N674h5A-cVc9XiCG-N0TChPo3-mRVmOtUm-GYup9evK-3d4
License ADD VljH169B-cVe22hrW-U/HMICqW-1aeB5pJE-YpZIOThd-eBc
License ADD FIsc70dC-cVeVN9Ed-J833n4q4-vyMgnOXM-HjsMKrhT-qy0
License ADD LOGJz+RC-cVecSpK5-57AOrUlA-6aD3n5Fy-ejFGFIIa-XPU
我如何使用上面的代碼片斷添加字符串列表這些作爲內容的文本文件.. 會不會有人請就這個..幫助 提前許多感謝....
正在使用這些字符串在一個選項臨時文件 - 這將是快速和簡單的,也許否則內存流? – BugFinder