Jump to content

how to knowthe forwarder email using imap functions


indianyogi

Recommended Posts

I have 2 gmail accounts and am forwarding all msgs from them  to my other single mailbox.

 

Now, I access my mailbox using imap functions.

 

Is there any function/way using which i can know which mail is forwarded by which gmail id?

 

Note:

My Attempts with imap_fetch_overview were semi-success, except for one case. (Please read the steps below)

 

1. if someone sends an email to me ..in this fashion -> [To:[email protected],[email protected]]

2. this mail gets forwarded to my mailbox from gmail.

3. using imap_fetch_overview i echo $overview->to, which shows [email protected] instead of myemail@gm....

 

i think i CAN use msg header, but i am clueless .. HOW!?

 

 

 

 

 

Use toaddress from the imap_headerinfo that will give you all the email address send to..

to put them into an array you could do this

*untested*

<?php
$info = imap_headerinfo($m_mail, $msgid)
preg_match_all('/\s?[^,]*/', $info->toaddress , $toaddress);
$toaddress= $toaddress[1];
echo "<pre>";print_r($toaddress);
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.