मैं ईमेल बॉडी सामग्री नहीं ला सकता हूं।मेल बॉडी सामग्री लाने के लिए PHP में IMAP का उपयोग कैसे करें?
यह मेरा कोड
<?php
/* connect to server */
$hostname = '{myserver/pop3/novalidate-cert}INBOX';
$username = 'username';
$password = 'password';
/* try to connect */
$inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Tiriyo: ' . imap_last_error());
//echo $inbox;
/* grab emails */
$emails = imap_search($inbox,'ALL');
/* if emails are returned, cycle through each... */
if($emails) {
/* begin output var */
$output = '';
/* put the newest emails on top */
rsort($emails);
/* for every email... */
foreach($emails as $email_number) {
//$email_number=$emails[0];
//print_r($emails);
/* get information specific to this email */
$overview = imap_fetch_overview($inbox,$email_number,0);
$message = imap_fetchbody($inbox,$email_number,2);
/* output the email header information */
$output.= '<div class="toggler '.($overview[0]->seen ? 'read' : 'unread').'">';
$output.= '<span class="subject">'.$overview[0]->subject.'</span> ';
$output.= '<span class="from">'.$overview[0]->from.'</span>';
$output.= '<span class="date">on '.$overview[0]->date.'</span>';
$output.= '</div>';
/* output the email body */
$output.= '<div class="body">'.$message.'</div>';
}
echo $output;
}
/* close the connection */
imap_close($inbox);
?>
जब मैं Gmail से ईमेल लाने के लिए उपयोग करते हैं, ईमेल शरीर सामग्री प्रदर्शित किया जाता है, लेकिन एक बार मैं अपने मेल सर्वर का उपयोग, मैं ईमेल के मुख्य भाग की सामग्री को नहीं लाया जा सकता है।
क्या आप इस समस्या को ठीक करने में मेरी सहायता कर सकते हैं?
आप किस मेल सर्वर का उपयोग कर रहे हैं? – Ben
इसका परीक्षण किया; जैसा कि आपने कहा था, आपकी स्क्रिप्ट जीमेल के साथ ठीक काम कर रही है। त्रुटियां शायद आपके मेल सर्वर से आ रही हैं। क्या कोई अन्य विवरण है जो आप प्रदान कर सकते हैं? – Ben
शायद http://stackoverflow.com/questions/5170489/php5-imap-i-aint-got-no-body – dkarp