Rails - email as part of a conversation (mailboxer?) - ruby-on-rails

I have a rails app that needs 'conversations' between two entities around a shared object (a proposal). Very simple, just two or more users chatting about the shared object. I have looked at a couple of gems, including Mailboxer, but was thinking of handrolling it instead.
However, the client wants the users to A) be sent email of the conversation (no problem) and B) be able to reply to those emails, where the reply gets added to the conversation. This would likely be similar to how eg airbnb handles it:
It's the B part that I'm struggling with. To my knowledge, Mailboxer wouldn't handle this. Are there other gems that do? Or do I need an entirely different approach?

You should use gem msgthr to handle conversational mail.
https://rubygems.org/gems/msgthr/versions/1.2.0

Related

Handle emails in a Rails 7 Multitenant Web App

I'm developing a multi tenant (with apartment gem) dashboard application with Rails 7. I've bought my own domain for the application but I have no email service yet.
How does my app work?
A customer sign up for it
He can decide to use a custom subdomain like customer1.example.com to reach his dashboard
He also can chose to use his own domain like customer1.com. I've handled this part with cloudflare for SaaS feature
He will use his own dashboard to let other people join, create accounts, interact with that dashboard
What am I looking for?
I'm looking for the best solution to implement these features:
Sending and receiving email for my application: something like info#mydomain.com, support#mydomain.com etc... (and this is the "easy" part. I think I simply need an email host
Here's come the (for my little experience) hard part:
How can I create a system of mail for actions like signup confirmation etc? I think those could just be some sort of "from" email and don't really need to exists.
How can I let the customer send/receive mail sent for example to customer1#mydomain.com or info-customer1#mydomain.com?
In case I just said something really stupid, what should be the correct way to handle emailing in an application like this?
Thanks to everyone, tell me if you need more information!
customer1#mydomain.com and info-customer1#mydomain.com are mailboxes.
You should create the setting for each company and use it to send/receive the email. For dynamically, you can create options to select belike "send as a mailbox"
If you want to find a product to manage sent/received emails from many mailboxes, you can try this instead of implementing

Ruby on Rails. Using Google Client API to parse emails

I am new to Ruby and have a question about how to do a specific task on Rails.
I have a list of inventory and each item has a specific Stock ID that is emailed to my personal Gmail account. I want my web application to listen for emails from a specific email account. When my gmail receives an email from that specific account I want my application to parse it for a couple of fields and insert the stock ID into my database.
For example:
Let's say my database has an item with style code: A5U31 and size:10.
The email will say something like item with style code: A5U31 and size:10 has Stock ID:329193020.
I want my Rails application to search the database for an entry with that specific style code and size, and when it finds an entry to simply insert the stock ID into the row.
I am trying to using the Google-API-Client gem to this, but I am struggling, because I am still a beginner. So far I have done this quick-start guide to authenticate my gmail account with my rails app.
https://developers.google.com/gmail/api/quickstart/ruby?authuser=2
If someone could help me figure out how to write this sort of code and where to put it in my app(models, controllers, views) that would be very appreciated. Thanks!
I know it's been several months since you posted this, so you probably already have it worked out, but in case you still need a solution (or if someone else wants to do something similar), I'll share my thoughts:
At a high level, it sounds like your plan is
Identify when a new email has come in (either by polling or by using a push notification).
Grab the new email's content.
Parse the email's content in order to extract relevant data.
Use the data to query and update a database.
Based on the documentation for the Gmail API, it does look like you should be able to set up push notifications, so you won't have to poll the endpoint to get the information you need.
However, my big takeaway from this list is that none of the items on it really require Rails, since you're not exposing an external web API for requests. I suppose that you could leverage ActiveRecord to create an item model and use that to manage the database; however, since it seems like you'd only need to make some basic SQL queries (and the same ones each time), I'm not sure that bringing in ActiveRecord adds much value.
If I were trying to solve this problem myself, I would probably create a simple Ruby program that (a) uses the gem you mentioned to handle push notifications from the Gmail API, and (b) uses another gem to connect to whatever kind of database you're using (e.g. pg for Postgres) and make the necessary queries.
(All of this assumes, of course, that you aren't specifically using Rails for some other reason, e.g. adding this feature to an existing Rails application).

Any idea to archive emails in Conversations in Asana?

I would like to centralize every email from (or to) customers of a project in the Conversations view of a project in Asana. The goal is to keep an archive of all exchanges with a customer in one place for every team member.
I tried to use the project#mail.asana.com as CC in every emails that i send but customers don't have accounts on Asana (and i don't want them to access it) and so they can't save their replies in Conversations. I tried also to create an email group (in Google Apps) and add the Asana email at it but it didn't work.
Any idea to use the Conversations view as an archive ? Or maybe is there an external tool which integrate with Asana that can do this ?
Thanks a lot in advance !
Hmm, that's interesting! I suppose that if you don't have too many emails this makes some sense (otherwise it might make your Asana Inbox pretty noisy - everyone would see in their inbox every conversation)
I think what I would do is to set up a Gmail filter to automatically forward the email to your team. You can do this in Gmail like this: https://support.google.com/mail/answer/6579?hl=en. If you set up a good filter (i.e. sent to a group address) it seems like it would be pretty painless.
One thing to note is that the conversation in Asana will appear to come from whoever is associated with the email that's sending the conversation to Asana, so if you have a single POC with the outside world, it may make sense to only forward from their account. Alternatively, you could set up a special Asana user just for this purpose, and your teammates can follow a convention that "mailbot" (or whatever user it is) is just used to forward mail, and you should look at the content to get who the author was.

Rails 3 - Send Mails, Request request progress using ajax

i want to use Rails 3 to send a relatively large amount of emails to a couple of recipients. The email functionality is basically implemented, so that's not the matter here.
My problem is that this amount of emails is sent relatively slow. So i want to give the user a little feedback using AJAX. Now this feedback should be unique for each user of course. My first thought was to create a helper class which sends these mails using a thread and a method for requesting the progress. Problem is, how can I make this functionality unique to each user per session?
I'm new to Rails and have absolutely no idea, I think some kind of Stateful Session Bean (like EJB) should make it. Does Rails or one of its addons offer something like that?
Sorry for my english, it's a bit rusty. :)
may be this help sidekiq_mailer
this adds to your ActionMailer classes the ability to send mails asynchronously.

Create a simple private message system in rails with inbox, send, and reply's?

There are some gems out there to instantly have a simple messaging system for users which I have looked at but they don't really fit the bill in terms of having a way to easy customize them.
Therefore I would like to ask some suggestions of gems that you consider be good for an instant messaging on a site, or discuss how one could implement this functionality.
I have built a simple system before that consisted of a messages table like this:
inbox
outbox
friend request
replies
id|message_id|sender_id|receiver_id|is_reply|is_friendreq|message
I'm thinking of storing everything in this one table and get all messages of a certain user where the user_id == receiver_id. This is very basic. I'm learning Rails and try to learn how to implement this on best Rails practice, so any tips/suggestions/ideas are more than welcome.

Resources