Receive email in Ruby sinatra - ruby

Is there some way to receive emails with Sinatra? I've seen the pages that say how to do it with RoR, but none without. I have also found out how to send emails with the gem Pony. Thanks!

I believe you are looking for the mail gem (github). It has send and receive capability.
Update: I forgot that there is a Google Group too

Rails uses mail gem in order to send and receive emails. This gem can be used in Sinatra just as easily.

Related

How to forward message responses with ruby Lita?

I am working with a chatbot operating on the lita ruby gem using lita-hipchat. After a response is made to lita using hipchat, lita will be able to return messages to the user who created the response through the reply method. I would like to change this pattern and be able to send a hipchat to a secondary user, essentially being able to cc or forward that same response to more than one user. Is this possible using only the Lita gem?
I am aware that sending messages through http or the hipchat gem is another option for sending messages to secondary users, but I would prefer to do this through lita.
You can do this using Robot#send_messages. For example:
def my_handler_route(response)
user2 = Lita::User.find_by_id("user2")
target = Lita::Source(user: user2)
robot.send_message(target, "This message will go to User2!")
end
This is essentially what Response#reply is doing—but with the convenience of automatically targeting the original source.

public_send method_missing in spree with postmark

After install postmark gem and edit config/application as instruct. I try forget password in Spree but error shown in User Screen.
At the heroku logs I found the step public_send shown method_missing.
Don't know what missing?
Since it was a new web setup. The return email from postmark send back to that email asked to activate before send mail would work.
So I just click Confirm Signature then try again it worked.

does pony send response when it fails?

i've been using ruby pony gem to send emails
https://github.com/benprew/pony#readme
unfortunately documentation is not as big as i wish, just shows few methods to send email, but seems that doesnt return any message when the mail cannot be sent.
does anyone have this trouble ? so i wish to know if pony was not able to send email to tell the user that couldnt happen.
should i try with exceptions ? i'm new in ruby so i have tiny knowledge to make a decition.
Kind regards.
Pony can throw exceptions from the Net::SMTP or Mail gems on failure, so you can catch that exception and show the user the error message. See posts like this on the Google Group, though details are a bit scarce.

Email events in Sinatra

I am working on a Sinatra web app that needs to save any email that it receives in a db (or do something else as soon as a mail is received). What is the best tool for this job? I was looking at eventmachine and it seems a bit complex. I was considering the mail gem but it doesn't trigger events when mail is recieved. One final query: To test such an app, do I need it to host it online? If not, then how to do I send emails to the app and test?
Thanks a lot,
So Sinatra is a web server. Email doesn't come in from HTTP requests, so you need a mail server to receive the emails and assuming you still want to handle them in your Sinatra app, fire a request at your app.
check out http://steve.dynedge.co.uk/2010/09/07/incoming-email-in-rails-3-choosing-the-right-approach/ for a few options (it's thinking rails, but you should be able to translate)

Ruby mail APIs that can send an email to a phone

I am trying to write a program in Ruby that can send a email to a phone. Outside of the program, I am able to do this by sending an email to xxx-xxx-xxxx#vtext.com or any other carrier in my Apple Mail client, and it worked fine; it sends a text message to the targeted phone, but when I tried to use a Ruby API (I forget the name), that used sendmail, to send a message, it would not send the message. Are there any ruby APIs that can send an email to a phone? (Or can someone just list some different Ruby mail APIs that I can try)?
I've used ActionMailer and Pony (http://github.com/benprew/pony) in the past.
it should "just work" assuming your mailing system/settings are setup right.

Resources