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

  • Home
  • SEARCH
  • 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 3661354
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:17:46+00:00 2026-05-19T01:17:46+00:00

I am currently working on building a system for my client that could be

  • 0

I am currently working on building a system for my client that could be classed as a type of ticket system. However, instead of users inputting tickets like a normal system, the tickets are received from a third party (always the same third party) in email format that will be piped in.

What I need to look at (which I’ve thought using various ways but cant seem to pick out the best) is taking the details from the email and putting them into individual variables.

An example of the email that will be recieved is:

Name: Harry Smith
Status: Married
Address: 14 Tyne Road,
Littlewood
Manchester
MC2 3DN
Telephone: 01551 221502

Obviously the full email is alot longer, however what I am looking at doing is putting out the details from the email so I can process them as required by the new system. In reality I am looking for something that can store the information in the style of:

Name: %name%
Status: %status%
Address: %address%
Telephone: %telephone%

I just haven’t quite worked out how to code a string search that will find Name: and store every after it up until Status: is reached.

Any help or pointers would be great.

Thanks 🙂

  • 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-19T01:17:47+00:00Added an answer on May 19, 2026 at 1:17 am

    Read the data file in line by line. Explode each line with a “:”. If a count of that == 2 then you know you are on a new token, and in which case the key = index[0] and the value = index[1]. Now check the next line, if there is only one element after you run explode, simply add it to the previous key.

         $email = ...;//email here
         $email = str_replace(array("\r\n","\n\r","\n","\r"), "\r", $email); //fix line breaks         
    
         $emaillines = explode("\r", $email);
         $result = array();
         $key = "first"; 
         foreach($emaillines as $line)
         {
            $parts = explode(":",$line,2);
            if(count($parts)>1) 
            {
                $key = $parts[0];
                $result[$key] = $parts[1];
            }
            else
              $result[$key] .= "\r".$parts[0];
         }
    
         print_r($result);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently building an ecommerce site with PHP/MySQL. Recently, I have been working
I'm currently working on building a game which is on a planet, the way
I'm currently working on redesigning an application which is building a model from input
We are currently thinking of building a cache-system to hold data pulled out of
I'm currently tinkering at an OpenBSD system with a view to building myself a
I'm currently building a class in PHP that generates PDF documents using the WKHTMLTOPDF
The cms I'm currently working with only supports live editing of data (news, events,
I am working with google app engine and using the low leval java api
I have a page that is definitely not a form but I need to
What is the most proper way to accomplish all of the following: Create a

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.