IMAP

2017-03-10 1 views
0

에서 전자 메일 정보 받기 IMAP 에서 전자 메일 정보를 얻으려면 전체 코드 php 또는 html이 필요합니다. 예를 들어 전자 메일 및 암호 & IMAP 서버 을 받고 전자 메일을받습니다. 당신의 도움이IMAP

메신저

$server = '{imap.gmail.com:993/ssl}'; 
$user = 'myUser'; 
$password = 'myPassword'; 
$connection = imap_open($server, $user, $password); 
$count = imap_num_msg($connection); 
echo $ 

만 포함

+0

당신이 http://php.net/imap_open의 전체 예제를 시도 어떤 결과를 시도 ** 선택해 주셔서 감사합니다 사서함 ** ...? – deceze

답변

0
<table> 
<tbody> 
    <?php 
    /* connect to gmail */ 
    $hostname = '{domail.com:143/novalidate-cert}INBOX'; // domain.com instead of your site name 
    $username = '[email protected]'; //here your mail id 
    $password = 'password'; //here your password 

    /* try to connect */ 
    $inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error()); 

    /* 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) { 

    /* get information specific to this email */ 
    $overview = imap_fetch_overview($inbox,$email_number,0); 

    $message = imap_fetchbody($inbox,$email_number,1.2); 
    $structure = imap_fetchstructure($inbox, $email_number); 

    $output.= '<tr class="'.($overview[0]->seen ? 'read' : 'unread').'"> 
    <td class="mail-select"> 
    <div class="checkbox checkbox-primary m-r-15"> 
    <input id="checkbox1" type="checkbox"> 
    <label for="checkbox1"></label> 
    </div> 

    <i class="fa fa-star m-r-15 text-muted"></i> 

    <i class="fa fa-circle m-l-5 text-warning"></i> 
    </td>'; 

    $output.= '<td> 
    <a href="#" class="email-name">'.$overview[0]->from.'</a> 
    </td>'; 

    $output.= '<td> 
    <a href="#" class="email-msg">'.$overview[0]->subject.'</a> 
    </td> 
    <td style="width: 20px;"> 
    <i class="fa fa-paperclip"></i> 
    </td>'; 
    $output.= '<td class="text-right">'; 
    $mail_datetime=$overview[0]->date; 
    $cur_date=date('d-M-Y'); 
    $mail_date=date('d-M-Y', strtotime($mail_datetime)); 
    $mail_time=date('h:i A', strtotime($mail_datetime)); 
    if($cur_date==$mail_date) 
    { 
    $output.=$mail_time; 
    } 
    else 
    { 
    $output.=$mail_date; 
    } 
    $output.= '</td> 
    </tr>'; 
    } 

    echo $output; 
    } 

/* close the connection */ 
imap_close($inbox); 
?> 

</tbody> 
</table> 
+0

새내기를 부탁해.이 코드에서 내가해야 할 변화를 말해 줄 수 있니? –

+0

도메인 URL, mailid 및 비밀번호를 변경하십시오. – praveena

+0

나는 그것을 바꿀 수 있습니다. 괜찮은지 말해주세요!