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

    <tfoot id='l7tf0'></tfoot>

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

      如何在 ASP.NET 表单中使用 gmail SMTP

      时间:2023-10-06

        <tfoot id='utLbH'></tfoot>

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

        1. <legend id='utLbH'><style id='utLbH'><dir id='utLbH'><q id='utLbH'></q></dir></style></legend>

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

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

                问题描述

                我是 ASP 新手,正在对工作表单进行故障排除.我们这里没有人是 ASP 专家,因为我们使用 PHP.但我的 PHP 经验也很差,主要是单独使用 HTML/CSS.我当前的表单凭据如下所示:

                I am a ASP novice and am troubleshooting a form for work. None of us here are ASP experts as we use PHP. But I am on the bottom of PHP experience as well, mostly working with HTML/CSS alone. My current forms credentials look like:

                rotected Sub SubmitForm_Click(ByVal sender As Object, ByVal e As System.EventArgs)
                        If Not Page.IsValid Then Exit Sub
                
                        Dim SendResultsTo As String = "email to"
                        Dim smtpMailServer As String = "email server"
                        Dim smtpUsername As String = "email username"
                        Dim smtpPassword As String = "password"
                        Dim MailSubject As String = "Form Results"
                

                如何将此表单发送到 Gmail 地址?我知道我必须在某处包含端口(587),但不知道在哪里,因为这种形式与我见过的任何其他形式的语法都不匹配.任何帮助将不胜感激!

                How would I go about making this form send to a Gmail address? I know I must include the port (587) somewhere, but cannot figure out where, as this form doesn't match the syntax of any other forms I have seen. Any help would be greatly appreciated!

                推荐答案

                protected void SendMail()
                        {
                            MailMessage msg = new MailMessage();
                            System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient();
                            try
                            {
                                msg.Subject = "Add Subject";
                                msg.Body = "Add Email Body Part";
                                msg.From = new MailAddress("Valid Email Address");
                                msg.To.Add("Valid Email Address");
                                msg.IsBodyHtml = true;
                                client.Host = "smtp.gmail.com";
                                System.Net.NetworkCredential basicauthenticationinfo = new System.Net.NetworkCredential("Valid Email Address", "Password");
                                client.Port = int.Parse("587");
                                client.EnableSsl = true;
                                client.UseDefaultCredentials = false;
                                client.Credentials = basicauthenticationinfo;
                                client.DeliveryMethod = SmtpDeliveryMethod.Network;
                                client.Send(msg);
                            }
                            catch (Exception ex)
                            {
                                log.Error(ex.Message);
                            }
                        }
                

                这篇关于如何在 ASP.NET 表单中使用 gmail SMTP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:服务器响应是: 5.7.0 必须首先发出 STARTTLS 命令.i16sm1806350pag.18 - gsmtp 下一篇:System.Net.Mail.SmtpException:SMTP 服务器需要安全连接或客户端未通过身份验证

                相关文章

                  <bdo id='92TZl'></bdo><ul id='92TZl'></ul>
              3. <tfoot id='92TZl'></tfoot>

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

                  <small id='92TZl'></small><noframes id='92TZl'>

                    <legend id='92TZl'><style id='92TZl'><dir id='92TZl'><q id='92TZl'></q></dir></style></legend>