How to read multilingual emails using php?

I don't want any webmail script.

I want to use imap/pop3 functions

Following code works well for listing emails but have some errors and it cannot read email other than ENGLISH language

Help Anybody


// Inbox 

// Display Messages from POP by Ronny Adonis .                               

$host = "hostname"; 

// username 
$username = "mailboxusername"; 

$password = "password"; 

// make connection 

$inbox = @imap_open ("{". $host . "/pop3:110}",$username, $password) 
 or header("Could not connect. Somethings wrong !"); 

$total = imap_num_msg($inbox); 



// check all messages 
<script language=javascript><!-- 
function toggle() 
   for( var i = 0; i < document.form1.elements.length; i++ ) 
      document.form1.elements[i].checked = document.form1.tog.checked; 

<body bgcolor="White">  

// header 
$title = "Inbox ($total total)"; 

<table width="100%" border="0" cellspacing="0" cellpadding="6" > 
<tr bgcolor="#083580"><td valign="top" align="center" width="100%">&nbsp;</td> 
<td valign="top" align="center"> 
<a class="menu" href="compose.php" border="0"> 
<font face="Verdana" size="-2">Compose</font></a></td> 

<td valign="top" align="center"> 
<a class="menu" href="javascript:document.forms[0].submit()"> 
<font face="Verdana" size="-2">Delete</font></a></td> 

<td valign="top" align="center"> 
<a class="menu" href="inbox.php"> 
<font face="Verdana" size="-2">Send/Receive</font></a></td> 
if ($total > 0) 
<table width="100%" border="0" cellspacing="0" cellpadding="5"> 
<form action="delete.php" name="form1" method="post"> 

<tr bgcolor="#012752"> 
    <td width="3%"><font size="-1"> 
    <input type=checkbox name=tog onclick="javascript:toggle();">&nbsp;</font></td> 
    <td width="3%"><font size="-1">&nbsp;</font></td> 
    <td width="29%"><font face="Arial" color="#ffffff" size="-1"> 
    <td width="34%"><font face="Arial"  color="#ffffff" size="-1"> 
    <td width="21%"><font face="Arial"  color="#ffffff" size="-1"> 
    <td width="10%"><font face="Arial"  color="#ffffff" size="-1"> 

for($x=$total; $x>0; $x--)  
    $headers = imap_header($inbox, $x); 
    $structure = imap_fetchstructure($inbox, $x); 
// rotate  cell background color 
    if ($bgColor == "#FFFFFF") { 
           $bgColor = "#d8d8d8"; 
       } else { 
            $bgColor = "#FFFFFF"; 
   $from = ereg_replace("\"","",$from);  
// make date display 
   list($dayName,$day,$month,$year,$time) = split(" ",$date);  
   $time = substr($time,0,5); 
   $date = $day ." ". $month . " ".$time; 
 // restrict subject  lenght   
        if (strlen($subject) > 30) { 
           $subject = substr($subject,0,29) ."..."; 
<tr bgcolor="<?php echo $bgColor; ?>"> 
<td align="right" valign="top"> 
<input type="Checkbox" name="dmsg[]" value="<? echo $x; ?>"> 
<td valign="center"> 
<td valign="top"> 
<font face="Arial" size="-1"> 
<? echo "$from"; ?></font> 
</td><td valign="top"><font face="Arial" size="-1"> 
<a href="readmessage.php?id=<? echo $x; ?>"> 
    // correction for empty subject 
    if ($subject == "") 
    echo "No subject"; 
    echo $subject;  
</td><td valign="top"><font face="Arial" size="-1"> 
<?php echo $date; ?></font> 
</td><td valign="top"><font face="Arial" size="-1"> 
// message size 
echo ceil(($structure->bytes/1024)), " KB";  
// clean up 
// if mailbox is empty 
echo "<font face=Arial size=-1>You have no mail at this time</font>"; 

Recommended Answers

All 3 Replies

can you please tell me how I can get the body of email context here

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.