我使用php imap functiona来获取邮件内容。
以下是我的代码:
$hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
$username = $_REQUEST['email'];
$password = $_REQUEST['pwd'];
$inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error());
$emails = imap_search($inbox,'ALL');
if($emails) {
$output = '';
rsort($emails);
$i = 0;
foreach($emails as $email_number)
{
$overview = imap_fetch_overview($inbox,$email_number,0);
$message = imap_qprint(imap_body($inbox, $email_number));
}
}
显示我的邮件正文中的html数据以及一些原始数据。我该如何删除它。
--94eb2c03a0feeaad70054df6411a
Content-Type: text/plain; charset=UTF-8; format=fowed; delsp=yes
Content-Transfer-Encoding: base64
PT09IEZpbmFuY2UgLSAxIG5ldyByZXN1bHQgZm9yIFthbGliYWJhXSA9PT0NCg0KDQo8aHR0cHM6
Ly93d3cuZ29vZ2xlLmNvbS91cmw/cmN0PWomc2E9dCZ1cmw9JmN0PWdhJmNkPUNBRVlBQ29UTnpN
ek1EUTBPREE0TVRnNU9EWTJPVFl5TkRJYVptVXpOR0psT0Rnd00yTmpPREF6WXpwamIyMDZaVzQ2
VlZNJnVzZz1BRlFqQ05GMXNIbGsyejlRSXgyOGp0dmZuR1BfVWxraWZBPg0KDQoNCj09PSBOZXdz
IC0gMTAgbmV3IHJlc3VsdHMgZm9yIFthbGliYWJhXSA9PT0NCg0KQWxpYmFiYSdzIFN0cm9uZyBH
cm93dGggUmF0ZSBJcyBVbmRlcmFwcHJlY2lhdGVkDQpTZWVraW5nIEFscGhhDQpBbGliYWJhJ3Mg
aGlzdG9yaWNhbCBncm93dGggcmF0ZSBpcyBhbiBhdmVyYWdlIG9mIDUwJSBmb3IgdGhlIGxhc3Qg
Zml2ZQ0KeWVhcnMsIHdoaWNoIGlzIG5vdGhpbmcgc2hvcnQgb2Ygc3BlY3RhY3VsYXIuIE1hbmFn
ZW1lbnQgaXMgYWNjZWxlcmF0aW5nIHRoZQ0KLi4uDQo8aHR0cHM6Ly93d3cuZ29v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