邮件不是从网络托管服务器

时间:2016-08-22 04:08:17

标签: c# asp.net vb.net sockets email

我已联系formin我的网站。用GoDaddy托管Windows。当我在我的本地主机上测试联系时,它工作了&发送邮件但托管它会给出例外情况。

  

System.Net.Mail.SmtpException:发送邮件失败。 ---> System.Net.WebException:无法连接到远程服务器---> System.Net.Sockets.SocketException:尝试在System.Net上的System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,SocketAddress socketAddress)中以其访问权限74.125.130.108:587禁止的方式访问套接字.ServicePoint.ConnectSocketInternal(Boolean connectFailure,Socket s4,Socket s6,Socket& socket,IPAddress& address,ConnectSocketState state,IAsyncResult asyncResult,Exception& exception)---内部异常堆栈跟踪结束---在System.Net.ServicePoint System.Net.PooledStream.Activate上的System.Net.PooledStream.Activate(Object owningObject,Boolean async,GeneralAsyncDelegate asyncCallback)中的.GetConnection(PooledStream PooledStream,Object owner,Boolean async,IPAddress& address,Socket& abortSocket,Socket& abortSocket6) (System owningObject,GeneralAsyncDelegate asyncCallback)在System的System.Net.ConnectionPool.GetConnection(Object owningObject,GeneralAsyncDelegate asyncCallback,Int32 creationTimeout)。位于System.Net.Mail.SmtpClient.Send(MailMessage消息)的System.Net.Mail.SmtpClient.GetConnection()上System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint)的Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint) )---内部异常堆栈跟踪结束---位于G:\ PleskVhosts \ brandstik.in \ httpdocs \中DynamicPage.sendInquiry_Click(Object sender,EventArgs e)的System.Net.Mail.SmtpClient.Send(MailMessage消息) DynamicPage.aspx.vb:第173行

try {
    MailMessage mail = new MailMessage();
    SmtpClient SmtpServer = new SmtpClient();
    mail.To.Add("abc@gmail.com");
    mail.From = new MailAddress(inquiryEmail.Text);
    mail.Subject = "Quote Request For " + quoteID.Text;
    mail.Body = "New Quote request from customer<br /><br/>Customer Name - '" + inquiryName.Text + "' <br />Customer Email - '" + inquiryEmail.Text + "'<br />Customer Contact - '" + inquiryNumber.Text + "'<br />Comment - '" + inquiryMessage.Text + "'";
    mail.IsBodyHtml = true;
    SmtpServer.Port = 587;
    SmtpServer.Credentials = new System.Net.NetworkCredential("xyz@doamain.com", "1234567890");
    SmtpServer.Host = "smtp.gmail.com";
    SmtpServer.EnableSsl = true;
    SmtpServer.Send(mail);
    Response.Write("Sent");
} catch (Exception ex) {
    //Response.Write("<script language='javascript'>alert('Your SMTP Server needs to get configured to contact form work.');</script>")
    Response.Write(ex);
}

1 个答案:

答案 0 :(得分:0)

似乎他们不允许这样做。您需要使用GoDaddys电子邮件中继服务器。请参阅此处的手册:https://www.godaddy.com/help/send-email-using-systemnetmail-19291