Gmail 域未收到电子邮件的 MVC .net

Gmail domain not receiving email's MVC .net

提问人:Dinesh Thangadurai 提问时间:1/30/2023 更新时间:1/30/2023 访问量:32

问:

我已将应用程序托管在 GoDaddy 服务器中,并使用 smtp 发送 maill。同时发送了Gmail域的邮件。邮件没有收到,我已经检查了垃圾邮件文件夹 aloso 没有得到它。

' public static bool SendEmailTemplate1(string emailId, string ccEmailid, string Msg, string sub, string fromId, string fromPass) { 尝试 { string mailServer = ConfigurationManager.AppSettings[“MailServer”].ToString(); MailMessage msg = 新 MailMessage();

            msg.To.Add(emailId);

            if (ccEmailid != null)
            {

                msg.CC.Add(ccEmailid);

            }
            msg.From = new MailAddress(fromId, "Dinesh");
            msg.Subject = sub;
            msg.IsBodyHtml = true;
            msg.Body = Msg;
            System.Net.NetworkCredential mailAuthentication = new  System.Net.NetworkCredential(fromId, fromPass);
            System.Net.Mail.SmtpClient mailClient = new
            System.Net.Mail.SmtpClient(mailServer, Convert.ToInt32(MailPort));
            mailClient.EnableSsl = Convert.ToBoolean(MailSSL);
            mailClient.UseDefaultCredentials = false;
            mailClient.Credentials = mailAuthentication;
            ServicePointManager.ServerCertificateValidationCallback = delegate (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };
            try
            {
                mailClient.Send(msg);
            }
            catch (System.Net.Mail.SmtpException ex)
            {
                Common.AjaxErrorLog("EMAIL", "SENDEMAIL", ex);
                throw ex;
            }
            return true;
        }
        catch (Exception ex)
        {
            Common.AjaxErrorLog("EMAIL", "SENDEMAIL", ex);
            throw new Exception("EMAILERROR: " + ex.Message.ToString());
        }
    }`

发送邮件时没有错误显示 gmail 域。我需要知道共鸣。

C# asp.net .NET 电子邮件 SMTPConlient

评论


答: 暂无答案