简体   繁体   中英

How can I get sender email address while using zend imap

I have uploaded the whole screenshot of the mail which is sent to my gmail id. But fetch at my website using zend imap.

here I am not able to figure out the exact sender email address header.

as you can see I am getting sender name not email in 'From' Header.

Any Ideas?

This is Screenshot: 在此处输入图片说明

ot looks like the problem may be Yahoo is not providing a classic address in the header it's providing a user number as demonstrated by:

->recieved[7]; 

and at :

->message-id;

these both reference what appears to be the sender (or at least the first leg in yahoo) web122216.mail.ne1.yahoo.com .

This is your sender (at least it appears as such). You may have to pound on the yahoo api to get better results for an actual e-mail address.

...Good Luck

Try this:

$header = imap_rfc822_parse_headers($storage->getRawHeader($email_id));
$from_email = $header->from[0]->mailbox . "@" . $header->from[0]->host;

Works for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM