Roundcube Community Forum

 

Roundcube API

Started by elasticguy, April 05, 2014, 04:59:02 AM

Previous topic - Next topic

elasticguy

Hello everyone! :)

I am making my own CMS and I was wondering if I can get the current unread amount of emails and from who the email was ( so from what email adress) and the subject of the email.

Is this possible with the API or is it also possible without the API? I didn't find much about the API though.

- ElasticGuy

SKaero

I think your thinking of the plugin api which doesn't allow you to get data from a third party source it only to code plugins for Roundcube. You need to make a script that checks the imap server for the unread count (the same thing the Roundcube does), maybe check out the Roundcube framework and see about integrating that into your CMS.

elasticguy

#2
Oh ok, I've looked for the code in the roundcube source but couldn't really find it so I made tits this xD Gonna test it in a sec but thanks for your help :)


<?php
$imap imap_open("{imap.myserver.org}INBOX""username""password")
or die("can't connect to IMAP");

$check imap_mailboxmsginfo($imap);

if ($check
{
echo "Unread: "   $check->Unread  "<br />\n" ;
}
else 
{
echo "imap_check() failed:";
}
imap_close($imap);
?>



Edit Hmm weird I can't get that code working. It's not echoing anything. Do you see the mistake?

SKaero

Check for errors. If I had to guess its because your trying to use the PHP imap extension which isn't included in most PHP installations.

elasticguy

I didn't get any errors and @ the php.net page they don't say you have to include anything

SKaero

You don't need to include anything but it does need to be complied as part of PHP: http://www.php.net/manual/en/imap.installation.php I can't really offer any other help since Roundcube doesn't use the standard PHP imap extension I don't know much about it.