Part of the EllisLab Network
   
2 of 2
2
New IMAP library!
Posted: 28 June 2009 11:36 AM   [ Ignore ]   [ # 11 ]  
Summer Student
Total Posts:  27
Joined  06-09-2008

i get this error when i try to connect:

“Certificate failure for mail.domain.com: self signed certificate: blah blah blah”

can anybody help?

 Signature 

one… take control of me… you’re messing with the enemy… said it’s two… it’s another trick… messing with my mind i wake up…

Profile
 
 
Posted: 29 June 2009 11:50 AM   [ Ignore ]   [ # 12 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1100
Joined  08-06-2006

add novalidate-cert to your service flags.

see http://www.php.net/imap-open for more info.

 Signature 

peeker email (imap/pop) | site_migrate | OOCalendar | PhotoBox2 | word_limiter

Profile
 
 
Posted: 28 September 2009 09:58 AM   [ Ignore ]   [ # 13 ]  
Summer Student
Total Posts:  14
Joined  09-24-2009

Thanks for this code, it works really well. The only issue I have is that when i ask for a list of the messages so that i can show an overview on the inbox, it marks all the messages as read, is there a way to get a the list of messages without it marking them all read?

cheers

$this->data['title'"Optra Mail";
        
$this->data['connected'FALSE;
        
$this->load->view('header_view',$this->data);
        
$this->load->view('pagetop_view',$this->data);
        
$this->load->library('imap');
        
// build login data
        
$query=$this->db->get_where("users",array('users.id' => $this->session->userdata('id')));
        
$userdata $query->row();

        if(
$this->imap->connect($userdata->email_user.'+vdomain.net'$userdata->password"vdomain.net"))
        
{
            $this
->data['connected'TRUE;
            
$this->data['mailbox'$this->imap->mailbox_info('array');
            
$this->data['messages'$this->imap->msg_list();
        
}


        $this
->load->view('email_view',$this->data);
        
$this->load->view('footer_view',$this->data); 
Profile
 
 
Posted: 28 September 2009 10:18 AM   [ Ignore ]   [ # 14 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1100
Joined  08-06-2006

hi promaneX welcome to CI!

i pulled this function out of my imap_pop class to show you how it could be done:

// loop over the messages by hand
// may be the best function to use
// to allow user feedback (i.e., progress bar)
function get_message_list_loop($start=0$end=0)
{    
    $a 
= array();
    
    
// start is the id
    // start it one down
    // because id immediately
    // increments in the next loop
    
$id = ($start==0) ? $start-1;
    
$end = ($end==0) ? $this->msg_count $end;

    while (
$id++ < $end)
    
{
        $a[] 
imap_headerinfo($this->IMAP_resource$id);
        
// it is not faster to use imap_fetchheader
        //$a[] = imap_fetchheader($this->IMAP_resource, $id);
    
}
    
return $a;
 Signature 

peeker email (imap/pop) | site_migrate | OOCalendar | PhotoBox2 | word_limiter

Profile
 
 
Posted: 28 September 2009 10:29 AM   [ Ignore ]   [ # 15 ]  
Summer Student
Total Posts:  14
Joined  09-24-2009

Thanks for the fast reply, sophistry! I will try to integrate that into my code :D

thanks again

Profile
 
 
Posted: 28 September 2009 06:16 PM   [ Ignore ]   [ # 16 ]  
Lab Assistant
RankRank
Total Posts:  280
Joined  06-11-2007

A while ago i myself came up with a library that would pull emails from a specific address, do stuff with them, save the attachments to disk and then store the necessary bits from the email into the SQL database.

And as Sophistry pointed out, i got hit with the encoded subject line on many occasions. Usually people using things like Outlook Express or Microsoft Outlook are the ones that end up sending those types of emails.

Mine is here: http://codeigniter.com/forums/viewthread/113286/

Nothing fancy, i only needed something very simple.

Profile
 
 
Posted: 28 September 2009 08:10 PM   [ Ignore ]   [ # 17 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1100
Joined  08-06-2006
ray73864 - 28 September 2009 10:16 PM

Usually people using things like Outlook Express or Microsoft Outlook are the ones that end up sending those types of emails.

i am usually in the blame M$ for everything camp too (mostly because they used to deserve it)... but in this case the encoded email fields are just how it is done these days - the internet is global.

heck, even the codeigniter email library encodes the subject of its outgoing emails to UTF-8!

 Signature 

peeker email (imap/pop) | site_migrate | OOCalendar | PhotoBox2 | word_limiter

Profile
 
 
Posted: 02 December 2009 12:02 PM   [ Ignore ]   [ # 18 ]  
Grad Student
Rank
Total Posts:  33
Joined  07-17-2008

hi, i would like to know if it’s only for me or not, but the connection takes a long time, about 15/20 seconds to connecter to my imap server… is that “normal ? what can i do to improve that ? Thanks !

edit: in fact it’s very slow on one of my computer and on the other one it’s very quick… any idea ?

Profile
 
 
   
2 of 2
2