发送邮件时发生异常

时间:2010-12-01 06:50:38

标签: asp.net

我正在发送邮件,但它给了我异常

Mailbox name not allowed. The server response was: sorry, relaying denied from your location [182.72.17.210] (#5.7.1)

我的代码

 public static string SendMailHtmlFromat(string sForm, string sTo, string sSub, string sMsg)
        {
            MailMessage mailmsg = new MailMessage();
            mailmsg.To.Add(sTo);
            mailmsg.From = new MailAddress(sForm);
            mailmsg.Subject = sSub;
            mailmsg.IsBodyHtml = true;
            mailmsg.Body = sMsg;
            try
            {
                //SmtpClient smtp = new SmtpClient("smtpout.secureserver.net", 25);
                SmtpClient smtp = new SmtpClient("relay-hosting.secureserver.net", 25);
                smtp.Credentials = new System.Net.NetworkCredential("admin@beautiful.com", "Smart123");
                smtp.Send(mailmsg);
            }
            catch (Exception e)
            {     }
            return "";
        }

是SmtpClient声明中的任何问题

1 个答案:

答案 0 :(得分:0)