Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6041307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:38:34+00:00 2026-05-23T06:38:34+00:00

I want to know if there is a way to parse a received email.

  • 0

I want to know if there is a way to parse a received email.

For example, someone sends me the following email:

  {
      product: "x_product",
      quantity: "1",
      price: "15",
  }

What I want is a way to get this information and insert it in the database
I know there is a method in ActionMailer::Base called receive.
Is this the correct approach? How to parse this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T06:38:34+00:00Added an answer on May 23, 2026 at 6:38 am

    Yes this is the correct approach, just google “receive mails with ruby on rails” – there are plenty of tutorials to guide you.

    The parsing depends on the kind of data you are about to receive. This looks like JSON, so you’d simply let a JSON parser do the work and it will give you a proper Ruby data structure. The rest (putting it into a DB) can be handled by a model.

    It would look a bit like this:

    class MailReceiver < ActionMailer::Base
    
      def self.receive(message)
        # depending on your Rails version you can use either TMail or Mail to parse the raw mail
        mail = TMail::Mail.parse(message)
    
        # parse the JSON
        my_data = ActiveSupport::JSON.decode(mail.body)
    
        # create something with the data
        MyModel.create(my_data)
      end
    
    end
    

    I did not cover the actual fetching of the mails from a mailbox. Again: google it, there are tons of tutorials out there. Have a look at Fetcher, which has always served me well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to know if there's any way to update from all versions (Example:
I want to know is there any way that I can remove duplicates from
I want to know is there any way or message in MFC by which
I want to know if there is a way to display an external php
I want to know if there is any way to fix all the PEP-8
I want to know if there is any way by which I can paste
I've got magazine app and I want to know If is there any way
I want to know if there is a better way (than what I'm currently
All I want to know is if there's an easy way to add lines
i want to know there a limitation in size for an iphone to display

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.