日期:2014-05-17  浏览次数:20953 次

asp.net本地发邮件QQ邮箱接收问题!
本帖最后由 sanjingliang123 于 2013-03-09 12:08:04 编辑
代码如下:
MailAddress from = new MailAddress("servie@abwoshu.cn","这是测试");
            MailAddress to = new MailAddress(uMail);
            MailMessage message = new MailMessage(from, to);
            message.Subject = strTitle;
            message.Body = strBody;
            message.IsBodyHtml = true;
            SmtpClient client = new SmtpClient("192.168.1.100");
            try
            {
                client.Send(message);
            }
            catch
            {
                //错误处理***

            }

由于QQ邮箱需要开启POP3/SMTP服务才能接收成功。求能够不设置也能让QQ邮箱接收成功的方法!!!

------解决方案--------------------
 /// <summary>
        /// 发送邮件
        /// </summary>
        /// <param name="toEMail"></param>
        /// <returns></returns>
        public string sendEmail(string toEMail) {
            try {
                SmtpClient smtp = new SmtpClient();
                smtp.Host = SMTP;
                smtp.Port = Int32.Parse(POST);
                smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
                smtp.Credentials = new System.Net.NetworkCredential(USER, PASS);
                if (SSL == "1")
                    smtp.EnableSsl = true;
                else
                    smtp.EnableSsl = false;

                MailMessage mm = new MailM