View Full Version : imap Forwarded

09-14-2011, 04:47 PM
I was going to see if there is a way to get the original from address from a Forwarded email address using the IMAP in PHP.

I am working on a support ticket system. I wanted to have an option setup so if someone(Jack@gmail.com) sends a support ticket to lets say one of our sales team members. The sales member can forward the support email to support@gamil.com and PHP could read the email and get the Jack@gmail.com from the email?

09-14-2011, 04:59 PM
I believe once forwarded the header will only contain the e-mail addresses relevant to THAT PARTICULAR SENDING (meaning only the sales team's address and the support team's address). That would make imap_headerinfo (http://www.php.net/manual/en/function.imap-headerinfo.php) worthless for that particular message.

BUT, it seems to me that you could work your way back to the original message using the "references" section of the header, and then pull up that message ID and get the original sender address from the message header there.

I'm not sure if that would still work if the sales team member had deleted the message though...

09-14-2011, 05:00 PM
I can run preg_match('/<(.*?)>/s',$message, $forwared_email); to the body of the email, but I was wondering if this would work 100% ?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum