Ich habe einen SmtpClient, der funktioniert, wenn ich es localhost ausführen. Doch auf dem Server von Google Cloud kehrt:SmtpClient funktioniert nicht auf Google Cloud-Server
System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond xx.xx.xx.xx:587
Mein Code:
MailMessage mailMessage = new MailMessage();
mailMessage.To.Add("User email");
mailMessage.From = new MailAddress("My Company Email");
mailMessage.Subject = "Test";
mailMessage.Body = "MSG Test";
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.mycompany.com"; //Or Your SMTP Server Address
smtp.Port = 587;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new System.Net.NetworkCredential
("[email protected]", "password");
smtp.Send(mailMessage);
Wer weiß, warum? Sollte ich Azure anstelle von Google Cloud für .net-Anwendungen verwenden?
Dank
Standardmäßig haben öffentliche SMTP-Server sehr restriktive Regeln zum Stoppen von Spam.Sind Sie sicher, dass Sie beispielsweise Ihre Quell-IP-Adresse auf die weiße Liste gesetzt haben? Ich habe es gerade mit Telnet getestet und es hat geantwortet. –
Ich werde Ihre Frage bearbeiten und die IP-Adresse auslöschen. –
versuchen Sie Port 25 auf Live statt 587 – Zoinky