你好, 我有自己的服务器,我也用它来发送和接收邮件。在第二次遭到黑客攻击后,我放弃并注册了使用我自己的域名处理我的电子邮件的Gmail。 我还启用了两步验证,两次黑客攻击让你保持谨慎。 我想从我的c#windows表单应用程序发送电子邮件,所以我设置了应用程序专用密码。仍然谷歌抱怨安全连接或客户端未经验证(需要5.5.1身份验证)。 在进行搜索时,您会发现很多建议可以为不太安全的应用程序提供保护,这不是我想要做的。 感谢您的想法。 我的尝试:
Hello, I have my own server, and I also used it for sending and receiving mail. After being hacked for the second time I gave up and signed up for gmail handling my email, using my own domain. I also have two-step verification enabled, being hacked twice makes you cautious. I want to send emails from my c# windows forms applications, so I've set up the app specific passwords. Still Google complains about secure connection or client not verified (5.5.1 Authentication required). When doing a search you find a lot of advice to turn of protection for less secure apps, that's not what I want to do. Thanks for your thoughts. What I have tried:
var fromAddress = new MailAddress("myemail@mydomain.toplevel", "From Name"); var toAddress = new MailAddress("myemail@mydomain.toplevel", "To Name"); const string fromPassword = "abcdefghijklmnop"; //app specific password const string subject = "test"; const string body = "This is a test!!"; var smtp = new SmtpClient { Host = "smtp.gmail", Port = 587, EnableSsl = true, DeliveryMethod = SmtpDeliveryMethod.Network, UseDefaultCredentials = false, Credentials = new NetworkCredential(fromAddress.Address, fromPassword), Timeout = 20000 }; using (var message = new MailMessage(fromAddress , toAddress) { Subject = subject, Body = body }) { smtp.Send(message); }推荐答案
我强烈建议您阅读:c# - Gmail错误:SMTP服务器需要安全连接或者客户端未经过身份验证。服务器响应为:5.5.1需要身份验证 - 堆栈溢出 [ ^ ] I'd strongly recommend to read this: c# - Gmail Error :The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required - Stack Overflow[^]
您是否遵循了各种配置步骤? SMTP中继:路由传出的非Gmail通过Google发送的消息 - G Suite管理员帮助 [ ^ ] 我可以立即看到的一件事是你没有使用文档中详述的smtp服务器,所以我要做的确定你已经彻底完成了文档,显然你订阅的服务允许中继(从你自己的域发送)。 Have you followed the various configuration steps? SMTP relay: Route outgoing non-Gmail messages through Google - G Suite Admin Help[^] One thing I can see right off the bat is that you're not using the smtp server detailed in the documentation so I'd make sure you've gone through the documentation thoroughly first, and obviously that you are subscribed to a service that allows relaying (sending "from" your own domain).
更多推荐
使用我的域名从C#winforms发送gmail
发布评论