Sunday 15 June 2014

php - How to extract emails from full headers -


I have some emails that I have opened with PHP and now need to get the sender's email address. Can I tell which function should I use for it? I already have email with PHP open

Edit: Is this a difficult question or I do not understand it adequately?

Do I use preg_match to get an email address? Opening materials?

Some mail send library, while Zend_Mail can parsed raw email Zend_Mail_Message must be able to do this by passing your raw email to the object. (Note: I have not seen reading a raw message, which I have seen.)

  $ message = new Zend_Mail_Message (array (), $ filename); $ Sender = $ Message- & gt; GetHeader ('to');  

If you need all the sender, then better to use a good RegEx, however, if you will test other headers / body / mime parts, then one The library will be worth it.


No comments:

Post a Comment