Welcome Guest, Not a member yet? Register   Sign In
New IMAP library!
#11

[eluser]sophistry[/eluser]
i think you misunderstood my suggestion about quoted_printable_decode(). i see you've added a class method _quoted_printable_encode() which does some limited transformation of urlencoded text (using str_replace()) and then runs a preg_replace() looking for "not newline chars" and replacing them with equals signs (some kind of word wrapping routine?). but, that code doesn't make sense there. that's the sort of thing you would do to prepare an email to send, not to receive... and the fact that it is named encode rather than decode? i'm not sure what issue the code solves at that point - it seems extra. is there something i am missing?

did you send yourself an email from the CI email lib and look at the source of the email to see the way the CI email lib prepares a quoted_printable encoded subject?
#12

[eluser]extra_rice[/eluser]
i get this error when i try to connect:

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

can anybody help?
#13

[eluser]sophistry[/eluser]
add novalidate-cert to your service flags.

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

[eluser]PromaneX[/eluser]
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

Code:
$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);
#15

[eluser]sophistry[/eluser]
hi promaneX welcome to CI!

i pulled this function out of my imap_pop class to show you how it could be done:
Code:
// 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) ? 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;
}
#16

[eluser]PromaneX[/eluser]
Thanks for the fast reply, sophistry! I will try to integrate that into my code Big Grin

thanks again
#17

[eluser]ray73864[/eluser]
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://ellislab.com/forums/viewthread/113286/

Nothing fancy, i only needed something very simple.
#18

[eluser]sophistry[/eluser]
[quote author="ray73864" date="1254194188"]Usually people using things like Outlook Express or Microsoft Outlook are the ones that end up sending those types of emails.[/quote]

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!
#19

[eluser]jeanv[/eluser]
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 ?




Theme © iAndrew 2016 - Forum software by © MyBB