SendGrid营销电子邮件延迟?

时间:2015-05-27 04:48:24

标签: asp.net vb.net sendgrid

步骤

  1. 创建收件人列表
  2. 创建营销电子邮件
  3. 将电子邮件添加到收件人列表
  4. 将收件人列表分配给营销电子邮件
  5. 当我慢慢调试时,我设法通过sendgrid的成功消息传递了所有步骤。

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

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

    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
    

1 个答案:

答案 0 :(得分:0)

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