Email creates new record in rails3? - ruby-on-rails

I'm not really sure where to start with this one, but here is what I'm looking to do.
Lets say you've registered at a website (yourwebsite.com). Your username/email is joe#shmoe.com.
If you email newrecord#yourwebsite.com, I'd like a new record created by your user (meaning you have to email it from a registered user's email - such as joe#shmoe.com).
I'd also like to add some variables in the email body, that can be set to their respective fields in the new record.
Does anyone know if this is possible?

sure is possible - have a look at http://cloudmailin.com/ too - they do all the receiving side of things for you and then just 'post' the email into your application.

It's definitely possible - that functionality is available in basecamp.
I've never done it myself, but looks like this article describes how to process incoming emails in rails. Good luck!

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

Can survey monkey handle a websites "forms"?

The API makes it sound like survey monkey is only good if I'm making an app.
My usecase is that I have a research project and I want to just shoot participants over to fill out a form, then use a webhook to know when they complete it. Like on my end I know my UserId, so I want to send user X to survey monkey to a SPECIFIC form, then when they complete it, I would like to know so I can log a complete entry in my DB.
Is this possible?
Yes, this is possible. Sounds like you want to create a private app (https://developer.surveymonkey.com/build-a-private-app/). In regards to the UserId tracking, use survey custom variables if you are using weblink collectors, or recipient custom fields if you are using email collectors.

Confirm multiple emails with devise

I am using rails+devise. I want the user to be able to confirm multiple e-mails (the app would send for each address a mail with a "confirm" link, and then the user have one or many confirmed mails). It is possible to confirm one with :confirmable (doc :
http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Confirmable )
I thought that i could play with
- (Object) resend_confirmation_instructions
by changing the address but this is not the best solution.
Is there a solution with devise or do i have to implement this specific functionnality?
You'll have to implement this yourself. Devise has one email per account, by default.
You'd not only need to handle multiple emails, but presumably you'd also want multiple confirmation_token's, along with multiples of the other database fields relating to email confirmation (find them in the devise migration file that gets generated). I don't imagine this will be a simple thing to solve with devise.
However, this sounds like a counter intuitive thing to do. Perhaps you should update your question to include the requirements of your app, and the reason why you need to get confirmation from multiple email addresses. Someone may have a solution for how to architect your app such that it doesn't need this feature.

Best way to send registration email (DEVISE)

Devise allows you to customize mailers here.
https://github.com/plataformatec/devise/wiki/How-To:-Use-custom-mailer.
However, I can also make a my own actionmailer like here.
http://railscasts.com/episodes/206-action-mailer-in-rails-3
When a user registers on my site, I would like to send two different emails, one to myself with the registration information and one to the user to thank them for registering.
What is the best way to do this? or is there a method that devise has that would allow me to do this? I was thinking of creating a hook(call back) in the model after a user is created. However, that would mean if I manually create a record, the registration emails would also be sent out. I don't want an email to be sent out if I manually create a user. Any advice?
You could have a callback such as after_create :send_email_to_admin
def send_email_to_admin
# your implementation
end
You would also put a conditional so it doesn't send an email when it's yourself creating the record manually. I do not think Devise offers such an option.
3 workarounds if you don't want to send email to your manually created users.
Create users at first, then add the hook.
Add a special pattern on the email of your manually created users. Say (.*)-very-weird-suffix#weired-email.com. You judge this pattern in the hook.
Add a field in users table to check if the account is created by you. I really don't recommend this unless creating accounts is part of your daily job.

Generating a new email address on the fly, but not really!

I have a blogging application. Once a blog-post is created by a user, it will be sent as an email to some of user's friends. I want a functionality where the friends will just reply to the email and the content of the email will go as comments for that particular blog-post.
One way to do this is to do something similar to what http://ohlife.com does. It basically creates a unique ID per user per day, has the reply-to attribute of the email set to post+{unique_id}#ohlife.com and probably parses this field to know which user is the email for, when it gets received. But it really has only 1 email address which is post#ohlife.com. The part after the "+" get's ignored by email servers. This also is applicable to gmail.
What I wanted to know, is whether this property is for particular email servers or is it universal? If it is not universal, is there is email server independent way of implementing this? I would not want this to be based on the email subject, as it's the trivial solution I know of.
it is depending on your mail server and how it is configured.. (although it is quite a standard) - for example in postfix:
recipient_delimiter = +
you could set it to anything you like .. i once configured it to be a dot so i can use it all over the web.. http://www.postfix.org/postconf.5.html#recipient_delimiter
but you could simply make it configurable in your application as well..
Besides using the email subject or address, one other easy way to accomplish this would be to just stick an identifier number at the bottom of the outgoing email's body. It would then come back to you in the quoted part of the response message. This is much less obtrusive than putting stuff in the subject or address, and if you're using HTML messages you can even make the code invisible.

Resources