私は私のウェブサイトに連絡しています。 GoDaddyでウィンドウをホストしてください。ローカルホストからの連絡先をテストしたところ、&がメールを送信しましたが、ホストすると例外が発生します。ウェブがウェブホスティングサーバーから送信しない
System.Net.Mail.SmtpException:メールの送信に失敗しました。 ---> System.Net.WebException:リモートサーバーに接続できません---> System.Net.Sockets.SocketException:アクセス許可74.125.130.108:587によって禁止されている方法でソケットにアクセスしようとしましたSystem.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure、ソケットs4、ソケットs6、ソケット&ソケット、IPAddress &アドレス、ConnectSocketState状態、IAsyncResult asyncResult、Exception)でのSystem.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot、SocketAddress socketAddress) &例外)---内部例外スタックトレースの終了--- System.Net.ServicePoint.GetConnection(PooledStream PooledStream、Object owner、Boolean async、IPAddress &アドレス、ソケット& abortSocket、ソケット& abortSocket6)at System.Net。 PooledStream.Activate(Object owningObject、Boolean async、GeneralAsyncDelegate System.Net.ConnectionPool.GetConnection(Object owningObject、GeneralAsyncDelegate asyncCallback、Int32 creationTimeout)のSystem.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)でのSystem.Net.PooledStream.Activate(Object owningObject、GeneralAsyncDelegate asyncCallback)での非同期コールバックSystem.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint)System.Net.Mail.SmtpClient.GetConnection()System.Net.Mail.SmtpClient.Send(MailMessageメッセージ)---内部例外スタックトレースの終了 - - G:\ PleskVhosts \ brandstik.in \ httpdocs \ DynamicPage.aspx.vbのDynamicPage.sendInquiry_Click(オブジェクト送信者、EventArgs e)のSystem.Net.Mail.SmtpClient.Send(MailMessageメッセージ):行173
try {
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient();
mail.To.Add("[email protected]");
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("[email protected]", "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);
}
GoDaddyのサポートに連絡し、アプリケーションがブロックされていないことを確認してください! –
これを参照してください:[Gmail SMTPはGodaddy Serverで動作しなくなりました](http://forums.asp.net/t/2094021.aspx?Gmail+SMTP+no+longer+working+in+Godaddy+Server) –
GoDaddyの制限を回避するには、SMTPではなくHTTPを使用してGmailにアクセスする必要があります。 Gmail APIを検討してください:https://developers.google.com/gmail/api/guides/ – Michael