Extracting information from email using php
Moderator: General Moderators
-
Razorsharp87
- Forum Newbie
- Posts: 2
- Joined: Wed Jun 03, 2009 6:04 am
Extracting information from email using php
I have a situation whereby people would send me their information using email. The process is pretty similar with each email. Thus, I was thinking if its possible to make it automated, to have a script to extract information from my email, process it accordingly and do the appropriate actions. My question would be, is there a way to extract information from an email using php? Or any other programming languages? Thanks!
P.S I'm using hotmail now. Is there any email providers that makes this process easier?
P.S I'm using hotmail now. Is there any email providers that makes this process easier?
Re: Extracting information from email using php
Using regualr expression (regexp) would be your best bet, I suggest Googling for some tutorials on it.
However, fi you're using Hotmail I don't see how you can get PHP to access the mails (easily).
However, fi you're using Hotmail I don't see how you can get PHP to access the mails (easily).
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: Extracting information from email using php
Sure, attach the data as CSV and open the email using IMAP functions, extract the attachment, voila...it's done all the time...
Re: Extracting information from email using php
I don't think that's what he's after. I'm assuming you want to extract the body of the email and use parts of it for soemthing?
-
Razorsharp87
- Forum Newbie
- Posts: 2
- Joined: Wed Jun 03, 2009 6:04 am
Re: Extracting information from email using php
Hi guys! Thanks for your input. I would check out "regexp" soon. And yeah what mikemike said is right. I would like to extract the body part of the email to do certain process for feedback.
Re: Extracting information from email using php
You're going to have issues with hotmail, I've never known any API to interact with it - although don't quote me on that as I haven't used anything to do with Hotmail since I was about 12 (a good 10 years ago now
).
If you must use your hotmail account perhaps you could forward your mail elsewhere using a tool by Hotmail ? Not sure if they offer this...
If you must use your hotmail account perhaps you could forward your mail elsewhere using a tool by Hotmail ? Not sure if they offer this...
- kaisellgren
- DevNet Resident
- Posts: 1675
- Joined: Sat Jan 07, 2006 5:52 am
- Location: Lahti, Finland.
Re: Extracting information from email using php
What is the problem we are solving here?
You can read it easily with IMAP like already stated: http://fi.php.net/manual/en/function.imap-body.php
You can read it easily with IMAP like already stated: http://fi.php.net/manual/en/function.imap-body.php
Re: Extracting information from email using php
So far as I can tell the problem isn't grabbing the email body, it's extracting set blocks of information from a string, which in this case happens to be an email. Grabbing the email content itself isn't the problem. Also, that link you posted isn't what was proposed earlier (not by you) I don't think, as the previous post was talking about attaching the data as a CSV, which I'm not sure was what was being described.
If he could show us a few example emails perhaps we could help him with the string matching...
If he could show us a few example emails perhaps we could help him with the string matching...
Re: Extracting information from email using php
Hi All,
I have an almost working script using PHP to access an IMAP email box and forward on to an SMS gateway any emails that match the filter.
The script is working but have one minor issue re decoding the subject.
See Post: viewtopic.php?f=1&t=100909
Many thanks
Paul
I have an almost working script using PHP to access an IMAP email box and forward on to an SMS gateway any emails that match the filter.
The script is working but have one minor issue re decoding the subject.
See Post: viewtopic.php?f=1&t=100909
Many thanks
Paul