I have a Rails app that uses ActionMailer conected with a gmail account to send email notifications.
Recently I put the "sending mail" feature on separate threads so the main request thread doesn't get blocked.
The problem is that some mails don't get sent. In the rails logs it says that the emails were sent, but if I open gmail in the browser and I look at the "sent" section, there are several mails missing.
I presume there is a "too many requests" error somewhere, because the mails are sent asynchronously, very fast. Does it help if I put an incremental delay in every thread? Is there a standard "cool-down" time after which sending mails is ok?
I don't want to use delayed job or other alternatives.
Related
I am integrating Twilio SMS service where my users are able to send SMS messages to their clients. I would like to be able to link each reply with the sent SMS. In another word, is there any field in the Message Resource that could lead me to conclude whether the incoming message received is related to the outgoing message my user sent previously ? I need same behavior as Email send/reply functionalities.
Twilio developer evangelist here.
There is no way to do this I’m afraid, the SMS protocol has no information about users replying to a specific message. SMS is chronological, you can test this by opening your phone’s SMS app and trying to reply to the second to last message you received from someone. In SMS there’s no way to do that.
The best thing you can do is consider the messages chronologically, and assume that the reply is in response to the last message you sent to that number from the number you sent it from.
I suspect your are interested in this because you need to send notifications and get responses to those notifications and you realised you might need to send more than one notification to a user at a time but still get their responses. The best way to get around this is to use different numbers to send the different notification messages from, then when they reply you can tell which notification they were replying to by the number they sent the message to.
I'm building a simple slack bot and can currently send private messages as well as checking for the last 10 messages received within this one-to-one channel.
Is there a way of getting a POST notification to my webservice whenever the user replies, instead of having to poll and continuously check messages on that one-to-one channel?
Now you can make use of Slack events to receive notifications.
In the give use-case, 'Message' event can be used to capture message received and process accordingly.
https://api.slack.com/events/message
Bots generally work by connecting to the real-time messaging API, a WebSocket-based API that sends you events as they happen. Specifically, you should see a message event sent to you every time a message visible to your bot is sent.
To answer your question, there's no way to get an HTTP POST sent to you instead; you'll need to connect to the RTM API and listen for events that way.
I am developing an iOS messaging app that uses Twilio to send and receive SMS and MMS. The tutorial on Twilio about the iOS client seems to only cover outgoing and incoming calls. I understand that sending an SMS/MMS would mean that I send a HTTP request to my server, in which my server sends the request to Twilio in order to complete the sending. However, how would I receive messages on my app?
I know that Twilio numbers have web hooks that execute when the number receives this message, but how would I get this message to my app. I don't believe that there are delegate methods included like the voice ones. The only solution that I could think of right now would be to use push notifications from my server to the phone. Is there any other possible way? Thanks.
I was recently in a similar situation to yours, but my app only cares about receiving a response within a 2 minute window while the app is opened.
Regardless, I would say that your best options include 1) push notifications, 2) sockets (probably via Socket.io), or 3) background polling. If you plan to have your application receive the message agnostic of its state (open, closed, etc), then I would highly suggest using push notifications. I'm using Parse as my Twilio backend and it makes creating and working with push notifications a breeze :)
I have webhooks configured for "send", "hard_bounce" and "soft_bounce".
At 15:12 I got an event from mandrill that email message was hard
bounced.
At 15:14 I got an event from mandrill that the very same
email message was sent.
messages.info API call says that the state of this message is "bounced".
Why mandrill behaves like that? Maybe it's a bug?
If it's not a bug then how to get notifications about successful delivery?
How to contact mandrill and file a bug report? I didn't find any place I could do that.
Update (20.04.2015)
Can you say that mail got delivered, if it contains positive smtp_events and state is sent?
You actually cannot get a webhook notification for when the email is delivered through Mandrill.
The only way of checking if an email has been delivered is to poll Mandrill (with the message/info.json API). To see if the message is delivered you have to check the smtp_events and look for an event with diag starting with 250.
Is it possible on iOS to send an email in the future, by setting a time and date, without notification? Can someone guide me?
YES it is possible. But for that you need to create a web service which will send mail on behalf of user with his/her notification.
Create web service, pass details for mail and send mail from there only is the only solution if you don't want to notify user or don't want to use MFMailComposeViewController for sending mails.
You can do this from an other server, you need a web server with php and mysql, you create a webservice, and send the "email" to the server, save it in the database with the subject, body and the date you want to send the email.
Than o the server you set up a cronjob that will run at specific intervals and check each email in the database to see if it's the time to send it, if so will send the email,
Basically this is the only solution you can have in this case, the user will think that he sent the mail, but the email will be sent later by the web server, not by the phone.
Use local Scheduling Local Notifications and using this you can send mail as per your requirements.
Scheduling Local Notifications
Hope, this will help you..