<i id='LTWfJ'><tr id='LTWfJ'><dt id='LTWfJ'><q id='LTWfJ'><span id='LTWfJ'><b id='LTWfJ'><form id='LTWfJ'><ins id='LTWfJ'></ins><ul id='LTWfJ'></ul><sub id='LTWfJ'></sub></form><legend id='LTWfJ'></legend><bdo id='LTWfJ'><pre id='LTWfJ'><center id='LTWfJ'></center></pre></bdo></b><th id='LTWfJ'></th></span></q></dt></tr></i><div id='LTWfJ'><tfoot id='LTWfJ'></tfoot><dl id='LTWfJ'><fieldset id='LTWfJ'></fieldset></dl></div>

        <bdo id='LTWfJ'></bdo><ul id='LTWfJ'></ul>
    1. <legend id='LTWfJ'><style id='LTWfJ'><dir id='LTWfJ'><q id='LTWfJ'></q></dir></style></legend>

      <small id='LTWfJ'></small><noframes id='LTWfJ'>

    2. <tfoot id='LTWfJ'></tfoot>

      从 CSharp/.net 使用 gmail SMTP 发送邮件

      时间:2023-10-05
      <legend id='Y6t2d'><style id='Y6t2d'><dir id='Y6t2d'><q id='Y6t2d'></q></dir></style></legend>
        <tbody id='Y6t2d'></tbody>
      • <bdo id='Y6t2d'></bdo><ul id='Y6t2d'></ul>
        <tfoot id='Y6t2d'></tfoot>

            <small id='Y6t2d'></small><noframes id='Y6t2d'>

              1. <i id='Y6t2d'><tr id='Y6t2d'><dt id='Y6t2d'><q id='Y6t2d'><span id='Y6t2d'><b id='Y6t2d'><form id='Y6t2d'><ins id='Y6t2d'></ins><ul id='Y6t2d'></ul><sub id='Y6t2d'></sub></form><legend id='Y6t2d'></legend><bdo id='Y6t2d'><pre id='Y6t2d'><center id='Y6t2d'></center></pre></bdo></b><th id='Y6t2d'></th></span></q></dt></tr></i><div id='Y6t2d'><tfoot id='Y6t2d'></tfoot><dl id='Y6t2d'><fieldset id='Y6t2d'></fieldset></dl></div>
              2. 本文介绍了从 CSharp/.net 使用 gmail SMTP 发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                using(SmtpClient client = new SmtpClient("smtp.gmail.com", 587)) 
                {
                    // Configure the client
                    client.EnableSsl = true;
                    client.UseDefaultCredentials = false;
                    client.Credentials = new NetworkCredential(textBox1.Text, textBox3.Text);
                
                    client.DeliveryMethod = SmtpDeliveryMethod.Network;
                    MailMessage message = new MailMessage(
                    textBox1.Text, // From field
                    textBox2.Text, // Recipient field
                    textBox4.Text, // Subject of the email message
                    richTextBox1.Text // Email message body
                    );
                
                    client.Send(message);
                
                    MessageBox.Show("Email has been sent.");
                }
                

                错误:SMTP 服务器需要安全连接或客户端未通过身份验证.服务器响应为:5.5.1 Authentication Required.

                我在使用 gmail 时遇到了这个错误,但我可以使用其他 SMTP 服务器来发送邮件.凭据正确.

                I have been getting this error with gmail but am able to use other SMTP Servers to send mails. The credentials are correct.

                推荐答案

                Gmail 帐户似乎存在安全问题.

                Looks like there is a security issue with Gmail account.

                我也遇到了同样的问题,然后从 这篇文章.

                I have also faced that same issue and then found solution from this post.

                帖子提到您需要在启用访问不太安全的应用程序"的情况下更改帐户权限设置.

                The post mentioned that you need to change the Account Permission setting with "Access of Less secure App" Enabled.

                事实上,当您登录到您的 gmail 帐户时,您会收到通知.

                In fact you will get notification when you logged in to your gmail account.

                这篇关于从 CSharp/.net 使用 gmail SMTP 发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:C# - SMTP - GoDaddy - 发送电子邮件 下一篇:1&1 网络托管和 smtp 配置

                相关文章

                <small id='zPYQ6'></small><noframes id='zPYQ6'>

                    <bdo id='zPYQ6'></bdo><ul id='zPYQ6'></ul>

                  <legend id='zPYQ6'><style id='zPYQ6'><dir id='zPYQ6'><q id='zPYQ6'></q></dir></style></legend>
                  <tfoot id='zPYQ6'></tfoot>
                    <i id='zPYQ6'><tr id='zPYQ6'><dt id='zPYQ6'><q id='zPYQ6'><span id='zPYQ6'><b id='zPYQ6'><form id='zPYQ6'><ins id='zPYQ6'></ins><ul id='zPYQ6'></ul><sub id='zPYQ6'></sub></form><legend id='zPYQ6'></legend><bdo id='zPYQ6'><pre id='zPYQ6'><center id='zPYQ6'></center></pre></bdo></b><th id='zPYQ6'></th></span></q></dt></tr></i><div id='zPYQ6'><tfoot id='zPYQ6'></tfoot><dl id='zPYQ6'><fieldset id='zPYQ6'></fieldset></dl></div>