private bool SendSysEmail()
        {
            string token = Math.Abs(Guid.NewGuid().GetHashCode()).ToString(CultureInfo.InvariantCulture);
            var    url   = string.Format("{4}/account/chkmail?userid={0}&useremail={1}&stamp={2}&code={3}", "lfyao", HttpUtility.UrlDecode("*****@*****.**"), DateTime.Now.Ticks, token, "wwww.test.com");
            var    body  = new StringBuilder();

            body.AppendLine(string.Format("您的用户名:{0}<br>", "姚立峰"));
            body.AppendLine(string.Format("<a href='{0}'>立即验证邮箱</a><br>", url));
            body.AppendLine("您也可以点击以下链接完成验证邮箱(72小时内有效):<br>");
            body.AppendLine(url);
            body.AppendLine("<br>(若该链接无法点击,请直接复制链接至浏览器地址栏中访问)");

            ISmtpMail mail = new SysMailMessage();

            mail.Subject            = "密码激活";
            mail.MailDomain         = "smtp.exmail.qq.com";
            mail.MailDomainPort     = 25;
            mail.MailServerUserName = "******";
            mail.MailServerPassWord = "******";
            mail.From          = "*****@*****.**";
            mail.FromName      = "姚立峰";
            mail.Body          = body.ToString();
            mail.RecipientName = "*****@*****.**";
            mail.AddRecipient("*****@*****.**", "*****@*****.**");

            return(mail.Send());
        }
Esempio n. 2
0
File: Program.cs Progetto: radtek/QM
 private static void test()
 {
     try
     {
         Console.Write("1234");
         log.Debug("1234");
         SysMailMessage m = new SysMailMessage();
         m.FromName = "Junxiao Liang";
         m.Subject  = "123";
         m.AddRecipient("*****@*****.**");
         m.Body = "test";
         m.Send();
         log.Debug("done");
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }