I need to read fields from this email
MOVE INFORMATION
Pickup Address: 34 Marigold Ln, Marlboro, NJ 07746
Delivery Address: 180 Prospect Park W, Apt 5, Brooklyn, NY 11215
Primary service dates:
Pack Date: N/A
Move Date: 6/6/2013
Other service dates:
Pack Date 2: N/A
Move Date2: N/A
Other Date: N/A
The process I am following is:
- Connect through IMAP
- get the nessage body
Now I want to read specified data and need to convert it into array like:
array( ' Pickup Address'=>'34 Marigold Ln, Marlboro, NJ 07746',
'Delivery Address'=>'180 Prospect Park W, Apt 5, Brooklyn, NY 11215'...)
I have tried preg_match('/(?P<Pickup Address>\w+): (?P<Delivery Address>\d+)/', $body, $matches)
but thats having some problem:
- It is not accepting space in 'Pickup Address'
- it is providing array in
Array ( [0] => Address: 34 [PickupAddress] => Address [1] => Address [DeliveryAddress] => 34 [2] => 34 )
format.
Basically I need to save these fields in database and I can not use attachment here. Let me know if you have any other solution or any way to make it work