如何为Gmail设置“确认订阅”按钮?

时间:2013-07-27 08:15:18

标签: c# gmail subscription microdata google-schemas

如何在MailChimp中创建“确认订阅”按钮?

到目前为止我的HTML代码:

<div itemscope itemtype="http://schema.org/EmailMessage">
  <meta itemprop="description" content="Confirmacao de inscricao" />
    <div itemprop="action" itemscope itemtype="http://schema.org/ConfirmAction">
      <meta itemprop="name" content="Confirmar Agora" />
      <div itemprop="handler" 
           itemscope itemtype="http://schema.org/HttpActionHandler">
        <link itemprop="url" 
              href="http://beta.pegacupom.com.br/confirmnews.aspx?code=xyz" />
      </div>
    </div> 
</div>

以上代码在“https://developers.google.com/gmail/schemas/testing-your-schema”中进行了测试,并且运行正常。

但是,当我将该代码放入我的c#网站时,电子邮件不会发送。

SPFDKIM可能有问题吗?

这是我用C#发送邮件的代码:

System.Net.Mail.MailMessage objMail = new System.Net.Mail.MailMessage();
objMail.From = new MailAddress("myemail@myDOMAIN.com", "myName");
objMail.To.Add(new MailAddress(emailTO));
objMail.Headers.Add("Content-Type", "text/html");
objMail.Body = mensagem;
objMail.IsBodyHtml = true;
objMail.SubjectEncoding = Encoding.GetEncoding("ISO-8859-1");
objMail.BodyEncoding = Encoding.GetEncoding("ISO-8859-1");
objMail.Subject = assunto;

SmtpClient objSMTP = new SmtpClient("smtp.myDOMAIN.com.br", 587);

System.Net.NetworkCredential objCredential = new System.Net.NetworkCredential("name@myDOMAIN.com.br", "myPASS");

objSMTP.Credentials = objCredential;
objSMTP.Send(objMail);

为什么电子邮件不发送?

1 个答案:

答案 0 :(得分:1)

尝试启用SSL:

objSMTP.Credentials = objCredential;
objSMTP.EnableSsl = true; // add this line
objSMTP.Send(objMail);

希望这有帮助。