SendGrid 营销电子邮件延迟?
SendGrid Marketing Email Delay?
步骤
- 创建收件人列表
- 创建营销电子邮件
- 将电子邮件添加到收件人列表
- 将收件人列表分配给营销电子邮件
当我调试缓慢时,我成功地通过了所有步骤,并收到来自 sendgrid 的成功消息。
但是在非调试模式下,虽然我成功地将电子邮件添加到收件人列表(来自 sendgrid 的结果 return),但在第 4 步中,我得到的结果是 return List 没有收件人。我刷新浏览器,在收件人列表中也看到了邮件。
我尝试在开始处理步骤 4 之前放置 timer.interval,但也得到相同的结果 return。
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 中,列表计数可能需要一段时间才能更新。 "force" 的一种方法是查询完整列表,这会触发系统进行计数,并更新计数,然后您可以正确附加它。
步骤
- 创建收件人列表
- 创建营销电子邮件
- 将电子邮件添加到收件人列表
- 将收件人列表分配给营销电子邮件
当我调试缓慢时,我成功地通过了所有步骤,并收到来自 sendgrid 的成功消息。
但是在非调试模式下,虽然我成功地将电子邮件添加到收件人列表(来自 sendgrid 的结果 return),但在第 4 步中,我得到的结果是 return List 没有收件人。我刷新浏览器,在收件人列表中也看到了邮件。
我尝试在开始处理步骤 4 之前放置 timer.interval,但也得到相同的结果 return。
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 中,列表计数可能需要一段时间才能更新。 "force" 的一种方法是查询完整列表,这会触发系统进行计数,并更新计数,然后您可以正确附加它。