当前位置: 首页>>代码示例>>C#>>正文


C# Message.AddRecipient方法代码示例

本文整理汇总了C#中Message.AddRecipient方法的典型用法代码示例。如果您正苦于以下问题:C# Message.AddRecipient方法的具体用法?C# Message.AddRecipient怎么用?C# Message.AddRecipient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Message的用法示例。


在下文中一共展示了Message.AddRecipient方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestBodyStructureWithNonLatinCharacter

        public void TestBodyStructureWithNonLatinCharacter()
        {
            Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");

             string attachmentName = "本本本.zip";

             string filename = Path.Combine(Path.GetTempPath(), attachmentName);
             File.WriteAllText(filename, "tjena moss");

             var message = new Message();
             message.Charset = "utf-8";
             message.AddRecipient("test", account.Address);
             message.From = "Test";
             message.FromAddress = account.Address;
             message.Body = "hejsan";
             message.Attachments.Add(filename);
             message.Save();

             TestSetup.AssertFolderMessageCount(account.IMAPFolders[0], 1);

             var oSimulator = new IMAPSimulator();
             oSimulator.ConnectAndLogon(account.Address, "test");
             oSimulator.SelectFolder("INBOX");
             string result = oSimulator.Fetch("1 BODYSTRUCTURE");
             oSimulator.Disconnect();

             // utf-8 representation of 本本本.zip:
             Assert.IsTrue(result.Contains("=?utf-8?B?5pys5pys5pys?=.zip"));
        }
开发者ID:jrallo,项目名称:hMailServer,代码行数:29,代码来源:Fetch.cs

示例2: SendMessage

        private void SendMessage(string subject, string body, string to, string cc)
        {
            var message = new Message();

             message.Charset = "UTF-8";
             message.AddRecipient("test", "meta'[email protected]");
             message.From = "Test";
             message.FromAddress = "meta'[email protected]";
             message.Subject = subject;
             message.set_HeaderValue("To", to);
             message.set_HeaderValue("cc", cc);
             message.Body = body;
             message.Save();
        }
开发者ID:japi,项目名称:hmailserver,代码行数:14,代码来源:MessageIndexing.cs

示例3: SendMail

    /// <summary>
    /// 发送邮件到网络
    /// </summary>
    public static void SendMail(string UserName, string PassWord, string SMTPServer, string Subject, string body, string FromEmail, string ToEmail,string FuJianList)
    {
        try
        {
            Message Jmail = new Message();
            DateTime t = DateTime.Now;

            //Slient属性:如果设置为true,Jmail不会抛出例外错误,Jmail.Send()会根据操作结果返回True或False
            Jmail.Silent = false;

            //Jmail创建的日志,提前loging属性设置为True
            Jmail.Logging = true;

            //字符集,缺省为"US-ASCII";
            Jmail.Charset = "GB2312";

            //信件的ContentType,缺省为"Text/plain",字符串如果你以Html格式发送邮件,改为"Text/Html"即可。
            //Jmail.ContentType = "text/html";

            //添加收件人
            Jmail.AddRecipient(ToEmail, "", "");
            Jmail.From = FromEmail;

            //发件人邮件用户名
            Jmail.MailServerUserName = UserName;

            //发件人邮件密码
            Jmail.MailServerPassWord = PassWord;

            //设置邮件标题
            Jmail.Subject = Subject;

            //邮件添加附件(多附件的话,可以再加一条Jmail.AddAttachment("c:\test.jpg",true,null);就可以搞定了。
            //注意:为了添加附件,要把上面的Jmail.ContentType="text/html";删掉,否则会在邮件里出现乱码
            string[] FuJian = FuJianList.Split('|');
            for (int kk = 0; kk < FuJian.Length; kk++)
            {
                if (FuJian[kk].Trim().Length > 0)
                {
                    Jmail.AddAttachment(System.Web.HttpContext.Current.Request.MapPath("../UploadFile") + "\\" + FuJian[kk].ToString(), true, null);
                }
            }

            //邮件内容
            Jmail.Body = body + t.ToString();

            //Jmail发送的方法
            Jmail.Send(SMTPServer, false);
            Jmail.Close();
        }
        catch (Exception e)
        {
            System.Web.HttpContext.Current.Response.Write("<script>alert('" + e.Message.ToString() + "');</script>");
        }
    }
开发者ID:cnbin,项目名称:HLB,代码行数:58,代码来源:Pop3ForJmail.cs

示例4: EmailReportErrorMessage

 /// <summary>Sends an email to the requestor of the report indicating that report generation failed.</summary>
 /// <param name="userId">The requestor/recipient of the report</param>
 /// <param name="startTime">The DateTime that the report was requested</param>
 public void EmailReportErrorMessage(string userId, DateTime startTime)
 {
     try
     {
         StringBuilder body = new StringBuilder();
         body.Append("An error occurred while generating the report requested on: ");
         body.AppendLine(startTime.ToShortDateString() + " at " + startTime.ToShortTimeString());
         body.AppendLine("<br/>Details of this error have been logged. Please try your operation again.");
         body.AppendLine("<br/>If this problem persists, please contact technical support.");
         Message mail = new Message(WebCommon.SmtpAddress);
         mail.AddRecipient(Security.GetUserEmailFromId(userId));
         mail.Subject = "Titan 360 Commission Report - Error";
         mail.From = ConfigurationManager.AppSettings["mailingName"].ToString();
         mail.Body = body.ToString();
         mail.SendEmail();
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
     }
 }
开发者ID:adayalantitan,项目名称:Apollo,代码行数:24,代码来源:sales_reports.aspx.cs

示例5: EmailReport

 /// <summary>Emails the report contained in the Attached MemoryStream to the specified user</summary>
 /// <param name="userId">The requestor/recipient of the report</param>
 /// <param name="attachmentName">The name of the Email attachment</param>
 /// <param name="report">MemoryStream object containing the report data</param>
 /// <param name="startTime">The DateTime that the report was requested</param>
 /// <param name="endTime">The DateTime that the report was completed</param>
 public void EmailReport(string userId, string attachmentName, MemoryStream report, DateTime startTime, DateTime endTime)
 {
     try
     {
         TimeSpan span = endTime.Subtract(startTime);
         string elapsedTime = span.Minutes + " minute" + ((span.Minutes != 1) ? "s, " : ", ") + span.Seconds + " second" + ((span.Seconds != 1) ? "s" : "") + ".";
         StringBuilder body = new StringBuilder();
         body.Append("Report requested on: ");
         body.AppendLine(startTime.ToShortDateString() + " at " + startTime.ToShortTimeString());
         //body.Append("<br/>Elapsed time: ");
         //body.AppendLine(elapsedTime);
         Message mail = new Message(WebCommon.SmtpAddress);
         mail.AddRecipient(Security.GetUserEmailFromId(userId));
         mail.Subject = "Titan 360 Commission Report";
         mail.From = ConfigurationManager.AppSettings["mailingName"].ToString();
         mail.Body = body.ToString();
         mail.AddAttachmentFromStream(report, attachmentName, "application/zip");
         WebCommon.WriteDebugMessage(string.Format("Emailing report at {0} to {1}, file size: {2}.", (startTime.ToShortDateString() + " at " + startTime.ToShortTimeString()), userId, report.Length));
         mail.SendEmail();
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         EmailReportErrorMessage(userId, startTime);
     }
 }
开发者ID:adayalantitan,项目名称:Apollo,代码行数:32,代码来源:sales_reports.aspx.cs

示例6: TestFetchBody

        public void TestFetchBody()
        {
            Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");

             string attachmentName = "本本本.zip";

             string filename = Path.Combine(Path.GetTempPath(), attachmentName);
             File.WriteAllText(filename, "tjena moss");

             var message = new Message();
             message.Charset = "utf-8";
             message.AddRecipient("test", account.Address);
             message.From = "Test";
             message.FromAddress = account.Address;
             message.Body = "hejsan";
             message.Attachments.Add(filename);
             message.Save();

             TestSetup.AssertFolderMessageCount(account.IMAPFolders[0], 1);

             var oSimulator = new IMAPSimulator();
             oSimulator.ConnectAndLogon(account.Address, "test");
             oSimulator.SelectFolder("INBOX");
             string bodyStructureResponse = oSimulator.Fetch("1 BODYSTRUCTURE");
             string bodyResponse = oSimulator.Fetch("1 BODY");
             oSimulator.Disconnect();

             Assert.IsTrue(bodyStructureResponse.Contains("BOUNDARY"));
             Assert.IsFalse(bodyResponse.Contains("BOUNDARY"));
        }
开发者ID:jrallo,项目名称:hMailServer,代码行数:30,代码来源:Fetch.cs

示例7: SendCCNEmail

 /// <summary>TBD</summary>
 /// <param name="isCompletion">TBD</param>
 /// <param name="contractNumber">TBD</param>
 /// <param name="attachmentUserId">TBD</param>
 public void SendCCNEmail(bool isCompletion, string contractNumber, string attachmentUserId)
 {
     string subject = string.Format("{1}CCN - Contract #: {0}", contractNumber, (WebCommon.InTestingEnvironment() ? "DISREGARD - EMAIL ORIGINATED FROM TEST SYSTEM" : ""));
     string userName = Security.GetFullUserNameFromId(attachmentUserId);
     string userEmail = Security.GetUserEmailFromId(attachmentUserId);
     string body = string.Format(@"<span style=""font-size:12px;font-family:Arial;"">{0},<br/><br/>The CCN you have submitted for this contract has been {1} by the Contract Administration team.<br/><br/>Please make sure to notify all markets affected by this CCN.</span>", userName, (isCompletion ? "processed" : "received"));
     Message ccnEmail = new Message(WebCommon.SmtpAddress);
     //Email ccnEmail = new Email();
     if (WebCommon.InTestingEnvironment())
     {
         ccnEmail.AddRecipient("[email protected]");
         ccnEmail.AddRecipient("[email protected]");
     }
     else
     {
         ccnEmail.AddRecipient(userEmail);
     }
     ccnEmail.From = "[email protected]";
     ccnEmail.Subject = subject;
     ccnEmail.Body = body;
     ccnEmail.AddCC("[email protected]");
     ccnEmail.AddBCC("[email protected]");
     ccnEmail.SendEmail();
 }
开发者ID:adayalantitan,项目名称:Apollo,代码行数:28,代码来源:QuattroService.cs


注:本文中的Message.AddRecipient方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。