gpt4 book ai didi

asp.net - SendGrid 营销电子邮件延迟?

转载 作者:行者123 更新时间:2023-12-01 06:24:09 33 4
gpt4 key购买 nike

步骤

  • 创建收件人列表
  • 创建营销邮箱
  • 将电子邮件添加到收件人列表
  • 将收件人列表分配给营销电子邮件

  • 当我缓慢调试时,我设法通过来自 sendgrid 的成功消息通过了所有步骤。

    但是在非 Debug模式下,虽然我将电子邮件添加到收件人列表成功(结果从 sendgrid 返回),但在步骤 4 中,我得到结果返回 没有收件人的列表 .我刷新了浏览器,也看到了收件人列表中的电子邮件。

    我尝试在开始处理步骤 4 之前放置 timer.interval,但也得到相同的结果返回。

    VB ProcessHandler 代码
    ' Add email and name to recipient list 
    If oSendMarketingEmail.AddEmailToList(oItemDetails.Email, oItemDetails.Full_Name, sRecipientList) = False Then Exit Try

    ' Wait for the email and name added to recipient list
    Dim timer As New Timers.Timer
    timer.Interval = 20000

    ' Assigning recipient list to marketing email
    If oSendMarketingEmail.AddListToMarketingEmail(sMarketingEmailName, sRecipientList) = False Then Exit Try

    VB函数代码
        Public Function AddEmailToList(sEmailAddress As String, sName As String, sRecipientList As String) As Boolean

    Dim ResultsHTML As String = ""

    Dim URL As String = (Convert.ToString("http://sendgrid.com/api/newsletter/lists/email/add.xml?list=") & sRecipientList) + "&data=" + "{""email"":""" + sEmailAddress + """,""name"":""" + sName + """}" + "&api_user=" + SendGridUserName + "&api_key=" + SendGridPassword
    Dim SendGridResponse As String = PerformHTTPGet(URL)
    ResultsHTML += (Convert.ToString("Adding email to List: ") & SendGridResponse) + "<br/>"

    ' Check respond status - success
    If Not ResultsHTML.Contains("insert") Then logger.log.Info(ResultsHTML) : Return False Else Return True

    End Function


    Public Function AddListToMarketingEmail(sMarketingEmailName As String, sRecipientList As String) As Boolean

    Dim ResultsHTML As String = ""

    'Assign list to marketing email
    Dim URL As String = (Convert.ToString((Convert.ToString("http://sendgrid.com/api/newsletter/recipients/add.xml?name=") & sMarketingEmailName) + "&list=") & sRecipientList) + "&api_user=" + SendGridUserName + "&api_key=" + SendGridPassword
    Dim SendGridResponse As String = PerformHTTPGet(URL)
    ResultsHTML += (Convert.ToString("Assigning Marketing Email to List: ") & SendGridResponse) + "<br/>"

    ' Check respond status - success
    If Not ResultsHTML.Contains("success") Then logger.log.Info(ResultsHTML) : Return False

    End Function

    最佳答案

    在 SendGrid 中,列表计数可能需要一段时间才能更新。 “强制”它的一种方法是查询完整列表,这会触发系统进行计数,并更新计数,然后您可以正确附加它。

    关于asp.net - SendGrid 营销电子邮件延迟?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30473403/

    33 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com