RoundCube Webmail Forum  

Go Back   RoundCube Webmail Forum > Third Party Contributions > Old Style Plug-Ins

For more information about the ads and why they're here, please see the FAQ
Reply
  #1  
Old 04-17-2009, 12:31 AM
Registered User
 
Join Date: Apr 2009
Posts: 2
Default print message body in a webpage

I want to use roundcube API to create a webapplication but i've some problem with the IMAP class.
I want to print in a web page information about a message (like date, subject, sender and body).
This is my code:
Code:
<?php

	include("lib/bugs.inc");
	include("lib/rcube_imap.php");
	include("lib/rcube_shared.php");
	include("lib/rcube_mdb2.php");
	include("lib/rcube_main.php");
	include("lib/rcube_message.php");
	include("lib/rcmail.php");
	include("lib/rcube_config.php");
	// include("lib/mime.php");
	// include("lib/rcube_mail_mime.php");
	
	$DB = new rcube_mdb2("mysqli://USERNAME:PASSWORD@HOST/DB");

	$imap = new rcube_imap($DB);

	$imap->connect("IMAP.SERVER", "USERNAME", "PASSWORD", 993, "ssl");
	echo "<br />" . $imap->get_mailbox_name();
	
	echo "<br />";
	foreach($imap->list_mailboxes() as $mailbox)
		echo "<br />" . $mailbox . "(".$imap->messagecount($mailbox).")";

	echo "<br /><br />";
	foreach ($imap->list_headers('Trash') as $header) {
		echo $header->date . " " . $header->uid. " " . $header->from . " " . $header->subject . " :: ";
		
		$MESSAGE = new rcube_message($header->id, $imap);
		if (!empty($MESSAGE->headers->charset))
			// $imap->set_charset($MESSAGE->headers->charset);
		
		$mbox_name = $IMAP->get_mailbox_name();
}
	$imap->close();
	
?>
It works but i can print on page only date, subject and sender... i can't print the message body, can someone help me?

tnx
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 04-17-2009, 01:37 PM
Registered User
 
Join Date: Apr 2009
Posts: 2
Default

Ok, I found a way to print a raw body:

Code:
$head = $imap->get_headers($header->uid, "Trash", TRUE, TRUE);
	echo $header->uid. " " . $header->from . " " . $header->subject . " :: <br />";
	echo $imap->get_raw_body($head->uid);
but I have a lot of problem to convert the body in a correct charset...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


For more information about the ads and why they're here, please see the FAQ

All times are GMT. The time now is 12:39 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Copyright © 2006-2008 RoundCube Webmail Community