简体   繁体   English

多个sendgrid电子邮件到短信电子邮件地址都不正常

[英]multiple sendgrid emails to text message email addresses are out of order

When my .NET (2015) windows app, on my Azure Windows server 2012 VM, needs to send a message that is over 160 characters to an email address to SMS text message service on a mobile, my app cuts the long message into 'chunks' each less than 160 chars, and then uses SendGrid to email each chunk. 当我的.NET(2015)Windows应用程序,在我的Azure Windows服务器2012虚拟机上,需要将超过160个字符的消息发送到移动设备上的短信服务的电子邮件地址时,我的应用程序将长消息切成'块'每个少于160个字符,然后使用SendGrid通过电子邮件发送每个块。

But they don't arrive in the order sent. 但是他们没有按照发送的顺序到达。 How do I fix this? 我该如何解决?

I've tried inserting a delay (thread.sleep) between each chunk, but that doesn't work. 我试过在每个块之间插入一个延迟(thread.sleep),但这不起作用。

You can't really. 你不能真的。 You have no control over when and the order that the text messages will be delivered/received by the end users phone. 您无法控制最终用户电话发送/接收短信的时间和顺序。 What you could try to do is break the message up and in your loop wait a minute before sending the next chunk. 你可以尝试做的是打破消息并在循环中等待一分钟然后发送下一个块。 There's no guarantee this will work though and it sounds like you already tried this. 不能保证这会起作用,听起来你已经尝试过了。

Compounding the issue is using SendGrid or any ESP (Email Service Provider). 使问题更复杂的是使用SendGrid或任何ESP(电子邮件服务提供商)。 When you send a request to most ESP's they queue up requests and send them. 当您向大多数ESP发送请求时,他们会排队请求并发送请求。 So even if you wait a minute to send your requests, they might get lined up in the queue and sent by the ESP all with in seconds of each other. 因此,即使你等待一分钟发送你的请求,它们也可能排在队列中并由ESP发送,所有这些都是在几秒钟之内完成的。

You might want to try using an SMS/MMS service provider like Twilio to send text messages. 您可能想尝试使用Twilio等SMS / MMS服务提供商发送短信。 Some of these services have logic already to break up messages that are too long into chunks automatically for you and have probably already worked on solving, as best they can, the out of order issue. 其中一些服务已经将逻辑分解为太长时间自动分组的消息,并且可能已经尽可能地解决了无序问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM