receive emails in rails app - ruby-on-rails-4

I know that we can receive emails into rails app using ActionMailer configuration or using griddler/mailman gems. But is that possible to receive unique emails?
Ex: When a user is signed up into the app I create him a unique email address.
When the user sends an email to that unique email address rails app should receive that email.
I used google to find the solution but couldn't get the answer. Please help me(reference links are also much appreciated).

no complete solution, but an idea: you could set up a catch all email address on your mail server that receives all mail sent to your domain.
then, in rails you use the mailman/mail gem to receive mails sent to this catch-all address and process it depending on the To header.

Related

Using sendgrid domain authentication sends email to spam in Django

I am trying to send email from my Django application. For this, I have used Twilio SendGrid service. Though my application can send the email, it ends up in spam folder. So, I have followed this tutorial to authenticate my domain which I bought from AWS route 53. In sendgrid, the domain authentication status shows 'verified' but the emails are still sent to spam folder. I have not created any MX or TXT record in DNS setting as the tutorial says it was created automatically during domain authentication in sendgrid.
One thing I have noticed that the email still shows, 'via.sendgrid.net' message (attached an image below) with the email. Whereas it should be my authenticated domain name. I have created sendgrid account with an outlook email and using that address to send email from Django app. Is this the reason my emails are going to spam? Or can anyone please help me to find a solution for this problem? Thanks in advance.
FYI: I have done 'Single Sender Verification' in sendgrid during developing this app. But now I have deployed it in aws. I guess this feature is still working instead of 'Domain Authentication'.

Revert emails fetched via django-mailbox, back to Gmail inbox

I am a Django newbie. I have setup a mailbox in Django admin using the django-mailbox package. The URI configuration was a Gmail IMAP email server. While retrieving mails into my Django mailbox, they got deleted from the inbox and got created as db records. Is there a way to revert the emails back to the Gmail inbox, either using a Django API, gsuite's email recovery, or exporting data from db into Gmail inbox?
Thanks in advance for your help.
P.S. the mails are not present in the trash folder.
You might try iterating over each django_mailbox.Message
instance, use the get_email_object method to help generate a MIME message, then use IMAP APPEND to put the message back in your online mailbox.

Receiving emails with sendgrid and cloudmailin

I have the same concept as mentioned in this question(generating a unique random email address for each user in rails app. When the user sends an email that that randomly generated email address, we process the body and store in db.
I followed the following steps:
Deployed my app in Heroku
Created a sendgrid account and configured the username and password to heroku(to get the sendgrid addon).
added griddler gem and followed the steps mentioned in griddler.
Configured the parse webhook in sendgrid with my host and url.
Here comes the main problem:
I registered to coludmailin and it generated the single email address. I don't really understand how to receive uniq emails to my rails application now. I tried white labeling the cloudmailin.net in sendgrid but it doesn't work(may be am wrong here).
Googled a lot but didn't understand how to proceed from here. Can someone please help me in solving this issue. Appreciate if I get a good step-by-step reference
There are two options to do this with CloudMailin.
Option 1:
On the free plan you can use a + in order to separate the email address given to you on CloudMailin and still create a unique email address that each customer can respond to. For example:
If you CloudMailin email address is example1234#cloudmailin.net you can use example1234+unique_id_54321#cloudmailin.net. CloudMailin calls unique_id_54321 the disposable part of this email address. This way you can send an email out and state the sender of that email is example1234+unique_id_54321#cloudmailin.net and then tell one user from another.
Option 2 (the better option):
However, the best way to do this is to use CloudMailin's custom domains. You can then receive anything#yourdomain.com.
With custom domains enabled you set CloudMailin up to be your MX server. Then any email coming into yourdomain.com goes direct to CloudMailin (you can use app.yourdomain.com to avoid conflicts with your regular email if needed).
You can then send email out with the sender as user-12345#yourdomain.com, task-12345#yourdomain.com or any other unique identifier. When you receive the email from CloudMailin the envelope will show that the email was sent to user-12345#yourdomain.com and you can then use this to resolve who the user was.

Can't send email to myself

I'm using opencart 1.5.1.3. For some reason I can't send an email to the same account I am sending from. For example, I can't receive the notification email when an order is placed. The email reaches the customer OK and if I specify additional email address to send the mail to, they receive the email OK, the email configured as the store email addres doesn't receive the email. I'm using the 'mail' option to send email.
The email is hosted at google apps. Please help
some web hosting prevent self-to-self email for safety reason.
maybe it is your hosting provider block this mail.

Send email from Openshift without no-reply#rhcloud.com

My Django application sends email out to users. On localhost, it was using my gmail account that i set via settings.py. However, when porting the app onto Openshift, all the headers were ignored. Instead of using the application from, reply-to email addresses, email coming from application on Openshift is FROM no-reply#rhcloud.com and no Reply-to email address.
Here is what I later found:
All e-mails routed through our servers have their From header rewritten. This will continue to function this way until we support e-mail as an "official" feature. Relaying through an external mail server should not overwrite this header." by Sumana Annam, Red Hat, Inc.
https://www.openshift.com/forums/openshift/sending-email-from-jboss-by-defect-the-from-is-no-replyrhcloudcom
Does anyone find a way of sending email from Openshift where the email header does not get rewritten?
Greatly appreciate any help/direction.
The official answer is that you would need to use a third party library to remove the no-reply#rhcloud.com. There is no way to change that header on email that is relayed through openshift's email servers.