PHP:
скопировать код в буфер обмена
<?PHP
header('Content-Type: text/html; charset=utf-8');
$hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
$username = 'sdsd@gmail.com';
$password = 'sdsds';
$inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error());
$emails = imap_search($inbox,'UNSEEN');//UNSEEN
if($emails){ // Check if there are any emails
rsort($emails); /* Sorts the email such that the new emails comes first*/
/* Get the email one by one using ID */
foreach($emails as $email_number) {
// Get the email [headers] like FROM, TO, SUBJECT, DATE, SERVER etc
$overview = imap_fetch_overview($inbox,$email_number,0);
echo "<b>From:</b> ".$overview[0]->from."<br>";
echo "<b>Date:</b> ".$overview[0]->date."<br>";
echo $overview[0]->subject."<br>";
// Get the Email Body
$message = imap_fetchbody($inbox,$email_number,1)."<hr><br>";
echo $message; // Prints the message in Text format.
}
}
/* close the connection */
imap_close($inbox);
?>
в результате выводит сообщение YXNkcyDQz8zV3snMPwo= а должен был вывести "Получил?"
так же крякозябры вылетают когда отображается, от кого пришло сообщение
=?KOI8-R?B?4czFy9PFyiDiz8rDz9c=?= а должно было вывести aboicov@gmail.com
в чем проблема?