如何从c#发送邮件时在SentBox中保存邮件 [英] How can I save mail in SentBox when mail sent from c#

查看:121
本文介绍了如何从c#发送邮件时在SentBox中保存邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

string frmusrnme = FromMailAddress;
                string frmpass = Password;
                string smtp = BOMast.BOParaMast.GetEmailFromSMTP();
                bool EnableSSL = BOMast.BOParaMast.GetEmailSSL();
                int port = Convert.ToInt32(BOMast.BOParaMast.GetEmailFromPort());
                SmtpClient SmtpServer = new SmtpClient();
                MailMessage mail = new MailMessage();
                SmtpServer = new SmtpClient(smtp, port);
                SmtpServer.Port = port;
                SmtpServer.Credentials = new System.Net.NetworkCredential(frmusrnme, frmpass);
                SmtpServer.EnableSsl = EnableSSL;
                SmtpServer.DeliveryMethod = SmtpDeliveryMethod.Network;
                mail.From = new MailAddress(frmusrnme);                mail.To.Add(ToMailAddress);
                if (MailCC.Length != 0)
                {
                    mail.CC.Add(MailCC);
                }
                mail.Subject = Subject;
                mail.Body = BodyText;

                foreach (var lifile in listFilename)
                {
                    string FilePath = System.Windows.Forms.Application.StartupPath + "\\EmailFile\\"+lifile;
                    Attachment attachment = new Attachment(FilePath);
                    mail.Attachments.Add(attachment);
                }                
                SmtpServer.Send(mail);
                Val.Message("Email Send Successfully...!!!");

推荐答案

您无法找到通过SMTP发送的电子邮件,因为它不使用您的邮箱发送这些电子邮件。

跟踪这些电子邮件的一种方法是,您可以在发送邮件时将发件人电子邮件地址添加到密件抄送。



或者您可以使用Exchange Web服务托管API发送电子邮件 [ ^ ]



希望,它有助于:)
You can't find emails sent through SMTP as it doesn't use your mail box to send those emails.
One way to keep track of those emails, you can add sender email address to bcc while sending mails.

Or you can Send Email with Exchange Web services Managed API[^]

Hope, it helps :)


这篇关于如何从c#发送邮件时在SentBox中保存邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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