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


C# MailMessage.ReadHtml方法代码示例

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


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

示例1: InsertEmailByResetPwd

        /// <summary>
        /// ��������ʱ�����ʼ�:����ɹ������ʼ���ʷ���в���һ����¼�����ʧ������SendEmailRecord�в���һ����¼
        /// </summary>
        public static int InsertEmailByResetPwd(string CustID, string OPType, string Message, string AuthenCode, int Result,
            string Email, DateTime DealTime, string Description, string SubjectName, int NotifyCount, Int32 ExpiredHour, out string ErrMsg)
        {
            ErrMsg = "";
            int SqlResult = ErrorDefinition.BT_IError_Result_UnknowError_Code;
            //��ȡģ��·��
            string EmailModelPath = System.AppDomain.CurrentDomain.BaseDirectory + @"XmlModel\ResetPwdMailModel.xml";
            try
            {
                //�����ʼ���Ϣ
                MailMessage mailMsg = new MailMessage();
                mailMsg.Subject = SubjectName;
                mailMsg.MailEncoding = MailEncodings.UTF8;
                mailMsg.MailType = MailTypes.Html;
                mailMsg.ReceiversList.Add(Email);

                String bodyText = mailMsg.ReadHtml(EmailModelPath);
                bodyText = bodyText.Replace("Message", Message);
                //���ӳ�ʱʱ��
                if (ExpiredHour > 0)
                    bodyText = bodyText.Replace("ExpiredHour", String.Format("�����ӽ���{0}Сʱ��ʧЧ", ExpiredHour));
                else
                    bodyText = bodyText.Replace("ExpiredHour", "");

                mailMsg.MailBody = System.Text.Encoding.UTF8.GetBytes(bodyText);

                //ʵʱ�����ʼ�
                //SqlResult = CIP2BizRules.EmailSend(mailMsg, out ErrMsg);
                SqlResult = EmailSend(mailMsg, out ErrMsg);

                if (SqlResult == 0) //��ɹ���ֱ�Ӽ�¼�����ʼ���ʷ��
                {
                    InsertEmailSendHistory(CustID, OPType, Message, AuthenCode, Email, 0, "", SubjectName);
                }
                else
                {
                    #region ����ʼ�����ʧ�ܣ����ʼ��������ݿ⣬��ͨ��windows�����������

                    SqlConnection mycon = null;
                    SqlCommand cmd = new SqlCommand();

                    mycon = new SqlConnection(DBUtility.BestToneCenterConStr);
                    cmd.Connection = mycon;
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "up_Customer_V3_Interface_SendEmailRecord";

                    SqlParameter parSubjectName = new SqlParameter("SubjectName", SqlDbType.VarChar, 100);
                    parSubjectName.Value = SubjectName;
                    cmd.Parameters.Add(parSubjectName);

                    SqlParameter parCustID = new SqlParameter("CustID", SqlDbType.VarChar, 16);
                    parCustID.Value = CustID;
                    cmd.Parameters.Add(parCustID);

                    SqlParameter parOPType = new SqlParameter("OPType", SqlDbType.VarChar, 1);
                    parOPType.Value = OPType;
                    cmd.Parameters.Add(parOPType);

                    SqlParameter parMessage = new SqlParameter("Message", SqlDbType.Text);
                    parMessage.Value = Message;
                    cmd.Parameters.Add(parMessage);

                    SqlParameter parAuthenCode = new SqlParameter("AuthenCode", SqlDbType.VarChar, 6);
                    parAuthenCode.Value = AuthenCode;
                    cmd.Parameters.Add(parAuthenCode);

                    SqlParameter parResult = new SqlParameter("Result", SqlDbType.Int);
                    parResult.Value = Result;
                    cmd.Parameters.Add(parResult);

                    SqlParameter parEmail = new SqlParameter("Email", SqlDbType.VarChar, 100);
                    parEmail.Value = Email;
                    cmd.Parameters.Add(parEmail);

                    SqlParameter parDealTime = new SqlParameter("DealTime", SqlDbType.DateTime);
                    parDealTime.Value = DealTime;
                    cmd.Parameters.Add(parDealTime);

                    SqlParameter parDescription = new SqlParameter("Description", SqlDbType.VarChar, 40);
                    parDescription.Value = Description;
                    cmd.Parameters.Add(parDescription);

                    SqlParameter parNotifyCount = new SqlParameter("NotifyCount", SqlDbType.Int);
                    parNotifyCount.Value = NotifyCount;
                    cmd.Parameters.Add(parNotifyCount);

                    SqlParameter parSqlResult = new SqlParameter("SqlResult", SqlDbType.Int);
                    parSqlResult.Direction = ParameterDirection.Output;
                    cmd.Parameters.Add(parSqlResult);

                    SqlParameter parErrMsg = new SqlParameter("ErrMsg", SqlDbType.VarChar, 256);
                    parErrMsg.Direction = ParameterDirection.Output;
                    cmd.Parameters.Add(parErrMsg);

                    DBUtility.Execute(cmd, DBUtility.BestToneCenterConStr);

                    SqlResult = Convert.ToInt32(parSqlResult.Value.ToString());
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:lihongtu,代码行数:101,代码来源:SetMail.cs


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