I am writing a simple php script for reading emails.
When I extract mail body with:
imap_body($mbox, $i);
I have returned something like this:
--0016e6db2b334d4d7904a883f4ec
Content-Type: text/plain; charset=ISO-8859-1
<The message arrived>
--0016e6db2b334d4d7904a883f4ec
Content-Type: text/html; charset=ISO-8859-1
<The message arrived>
--0016e6db2b334d4d7904a883f4ec--
How can I extract only: ? I am using php_imap.
Thanks.
If you are using IMAP, you can use the imap_body() function to read the body. PHP has ton of functions that will help you with parsing an email.
http://www.php.net/manual/en/ref.imap.php
Check out the fetch_body() function too. It will allow you to get just part of the body.
http://www.php.net/manual/en/function.imap-fetchbody.php
For example:
$message = imap_fetchbody($inbox,$email_number, 1.2);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With