2017-05-03 49 views
0

私のコードは他のドメインでもローカルでも動作しています。 Azureサーバーを介してメールを送信しようとすると、動作しません。 スタックオーバーフローでほとんどすべてのリンクを見ていますが、まだ機能していません。Azureサーバーのgmail SMTP経由でメールを送信できません

私はちょうどそれがうまく働いて、このコードの前に送信されたメールを使用して、この例外に

System.Net.Mail.SmtpException: Failure sending mail. ---> 
System.ComponentModel.Win32Exception: The client and server cannot communicate, because they do not possess a common algorithm\r\n at System.Net.SSPIWrapper.AcquireCredentialsHandle(SSPIInterface SecModule, String package, CredentialUse intent, SecureCredential scc)\r\n at System.Net.Security.SecureChannel.AcquireCredentialsHandle(CredentialUse credUsage, SecureCredential& secureCredential)\r\n at System.Net.Security.SecureChannel.AcquireClientCredentials(Byte[]& thumbPrint)\r\n at System.Net.Security.SecureChannel.GenerateToken(Byte[] input, Int32 offset, Int32 count, Byte[]& output)\r\n at System.Net.Security.SecureChannel.NextMessage(Byte[] incoming, Int32 offset, Int32 count)\r\n at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)\r\n at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)\r\n at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)\r\n at System.Net.Mail.SmtpConnection.Flush()\r\n at System.Net.Mail.ReadLinesCommand.Send(SmtpConnection conn)\r\n at System.Net.Mail.EHelloCommand.Send(SmtpConnection conn, String domain)\r\n at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)\r\n at System.Net.Mail.SmtpClient.GetConnection()\r\n at System.Net.Mail.SmtpClient.Send(MailMessage message) 
+0

例外をコピーして貼り付けてください。 –

+0

更新に関する質問plz check – Anjyr

答えて

1

を取得していますこの事に

smtp.Host = "smtp.gmail.com"; 
smtp.Port = 587; 
smtp.UseDefaultCredentials = false; 
smtp.Credentials = new System.Net.NetworkCredential 
("[email protected]", "***********"); 
smtp.EnableSsl = true; 

を使用しています。

System.Net.ServicePointManager.SecurityProtocol = 
    System.Net.SecurityProtocolType.Ssl3 
    | System.Net.SecurityProtocolType.Tls12 
    | SecurityProtocolType.Tls11 
    | SecurityProtocolType.Tls; 
関連する問題