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'm currently working on a project that is building a java-based desktop application to
I'm currently building a username/password/session-management/etc. system for a website I've been working on. I've
I'm currently working on building a java web app. I've been looking to use
I'm working on building the Boost platform for a currently unsupported toolchain. Obviously we'd
I'm working on a CakePHP project and am currently building the user authentication part
I'm currently building a class in PHP that generates PDF documents using the WKHTMLTOPDF
I am currently working on a C project that needs to be fairly portable
I'm working on building an HTTPHandler that will serve up plain text for use
I am building a website that is basically a small Content Management System. (in
I'm currently working on building an application in CakePHP. There's a quite extensive existing

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.