Some problems with IMP (attachemnt, ispell, wvhtml)
Thomas GUTHMANN
tom@calixo.net
Thu, 23 Nov 2000 12:24:44 +0100
Hello,
I'm currently tuning IMP to work correctly and it's hard work ;o)
I'm stilling having some little problems
1°/. When I receive an email witch attachment, I always have one or two
attachments with no description and multipart/mixed as below
---snip--snip--
Pièces jointes
[pas de description] multipart/mixed 476.32 KB
2 [pas de description] multipart/mixed 475.30 KB
2.2 document.doc application/msword 474.84 KB
(source du message)
---snip--snip--
Is there a solution to hide these attachements ?
2°/ To check the spelling, I'm using ispell with a french dictionnary
... but it doesn't work properly...it's highlight some correct word and
doesn't highlight false word ... strange
I'm using a slackware 7.1 and I have a francais.aff and francais.hash in
/usr/lib/ispell
Any idea ?
3°/ I installed wv so my clients will be able to see theirs word
documents (wvHtml) but when I click on a word attachment it opens a new
window with only 2 lines :
MS Word Viewer
Usage: /usr/local/bin/wvHtml
Path is ok, i'm sure ! But seems usage is incorrect ?!
Same, any idea ?
4°/ Last question (ouf ;o), when I'm doing some action such a click on
the send button for a new message I receive these messages in my apache
error log
--Snip --
<b>Warning</b>: Mailbox is empty (errflg=1) in <b>Unknown</b> on line
<b>0</b><br>
<br>
<b>Warning</b>: Mailbox is empty (errflg=1) in
<b>/var/lib/apache/htdocs/horde/
imp/compose.php3</b> on line <b>0</b><br>
--Snip --
And, I usually receive the message below when I do a click in inbox or
when i send a message
--Snip --
<b>Warning</b>: Mailbox is empty (errflg=1) in <b>Unknown</b> on line
<b>0</b><br>
--Snip --
Still any idea ;o) ?
5°/ It's not a question, but sometimes segfaulting but i don't know for
the moment, it's probably attachments ...
My configuration
P2 233 + 128Mo + linux 2.2.16
Apache 1.3.12
PHP 4.0.2 (with DSO)
horde 1.2.2 + IMP 2.2.2 (with horde phplib)
(i'm still a rookie with patching how can i use your patch 2.2.2->2.2.3
to patch my running config ?)
Mysql 3.2.???
IMP is a great project, and works well but to make it full working it's
hard work ! sure ;o)
Tom
HERE ARE MY DEFAULT.PHP3 AND MY MIME.PHP3
--------------------------------------------
DEFAULT.PHP3
--------------
<?php
/**
** General Webserver Configuration
**/
// Where does IMP live _in the web tree_? Ex: /horde/imp. IMPORTANT: Do
// _not_ put a trailing slash on this value. If IMP is the top-level
// thing in the web tree, the correct value is '' (empty string), not
// '/'.
$default->root_url = '';
$default->language = 'fr';
// Where do the graphics live _in the web tree_?. So, if IMP is at
// /horde/imp, and the graphics are at /horde/imp/graphics, then this
// should be set to '/horde/imp/graphics', or, a little bit more
// generally, $default->root_url . '/graphics'. The same caveat about
// trailing slashes applies.
$default->graphics_url = $default->root_url . '/graphics';
// Where are the templates? This is a filesystem path. The default
// installation places the templates in a subdirectory of the main imp
// directory; in this case the correct value is './templates', which
// is the default. Other possibilities might be
// '/etc/horde/imp/templates' or whatever, depending on how you set up
// your installation.
$default->include_dir = './templates';
// What umask should we run with? This will affect the permissions on
// temporary files created by uploading attachments, mswordview, and
// other attachment routines that use temporary files.
$default->umask = '077';
// Display the link to the new user introduction?
$default->newuser_link = true;
// Use as few new (popup) windows as possible?
$default->minimum_popups = false;
/**
** IMAP Configuration
**/
// What IMAP server should we connect to by default?
$default->server = 'mail.calixo.net';
// Should users be able to change the server they are connecting to?
$default->user_change_server = false;
// Should we display a list of servers (defined in
// config/servers.php3) for users to choose from? NOTE:
// $default->user_change_server needs to be true for this to be
// displayed.
//
// However, if you set user_change_server to false, and
// use_server_list to true, then the "preferred" mechanism by which
// the server list determines what server is selected by default will
// be used to determine which servers.php3 entry to use.
$default->use_server_list = false; // use server list dropdown
// If a user uses the default server, what domain should we send mail
// from? For example, if the default server is 'mail.foobar.com', and
// you want mail to be sent from user@foobar.com, instead of
// user@mail.foobar.com, you should set $default->from_server to
// 'foobar.com'.
$default->from_server = 'calixo.net';
// Should we complete addresses lacking an '@' in the compose window,
// and if so, what domain should we tack on? This is kind of a "combo"
// option: false means don't do it; any other value means to use that
// value as the domain to tack on. For example, $default->to_domain =
// 'foobar.com' would turn 'joe' into 'joe@foobar.com'.
$default->to_domain = false;
// What port should we connect to by default? The official port for
// IMAP is 143, so if you are unsure, you probably don't have to
// change this. However, if you are connecting to a POP3 server by
// default, you should set this to 110.
$default->port = '110';
// Should users be able to change the port they are connecting to?
$default->user_change_port = false ;
// What kind of server should we connect to by default? Valid values
// are 'imap' and 'pop3'.
$default->servtype = 'pop3';
// Should users be able to change the kind of server they are
// connectiong to?
$default->user_change_servtype = false;
// Should we allow users to use folders at all? NOTE: setting this to
// false will mean there is no place to save sent-mail or postponed
// messages, along with the obvious affects of restricting the user to
// their INBOX.
$default->user_use_folders = true;
// What prefix should we use to look for folders? For UW-imapd, this
// is very likely 'mail/'. If you don't know what to set this to,
// leave it empty (''), as that will never exclude anything from the
// list. If you find that you are getting too much, then set this
// value to the prefix that you want to restrict the list to.
$default->folders = '';
// Should users be able to change the folder prefix at login?
$default->user_change_folder = false;
// Servers like Cyrus and Courier-IMAP place personal folders in a
// hierarchy below INBOX, as INBOX.foldername. If you want the
// 'INBOX.' portion of that name hidden from your users, set this to
// 'INBOX.'. Otherwise, leave it blank.
$default->personal_folders = '';
// Should we use imap_subscribe? Doing so may cause users to be
// confused, as only folders that they have "subscribed" to will show
// up in the folder lists.
$default->use_imap_subscribe = false;
// Should we ignore files that begin with a '.' in the folder lists?
$default->show_dotfiles = false;
// Should we show any folders in UW-imapd's #shared/ hierarchy?
// Setting this to true on a non-UW server, or one that does not have
// this hierarchy, will probably have no effect.
$default->show_shared_hierarchy = false;
// Should we show any folders in UW-imapd's #public/ hierarchy?
// Setting this to true on a non-UW server, or one that does not have
// this hierarchy, will probably have no effect.
$default->show_public_hierarchy = false;
// Should we show any folders in UW-imapd's #news/ hierarchy? Setting
// this to true on a non-UW server, or one that does not have this
// hierarchy, will probably have no effect.
$default->show_news_hierarchy = false;
/**
** Sending Messages
**/
// Should we include the contents of imp/config/header.txt in the
// headers of every message sent?
$default->append_header = true;
// Should we append the contents of imp/config/trailer.txt to the end
// of every message sent?
$default->append_trailer = false;
// Should we run usernames through a custom function before sending
// mail? If true, IMP will look for a function
// imp_expand_fromaddress() to use to expand ... from addresses! :)
$default->custom_from_hook = false;
// Here is an example imp_expand_fromaddress function (It will
// probably not work for you by default!). You get passed the $imp
// object, and have access to evenything inside it, which should be
// plenty of information. You can global anything else you
// need. Return an address - either just the user@ side, or a full
// address, and it should be used.
//
// NB: If users are allowed to change their fromaddresses (not
// fullnames, though), and they have one set, this will be overridden.
//
// NB2: The code assumes that this function will return a reasonable
// address, so make sure to fall back to $imp->user or some such on
// failure.
function imp_expand_fromaddress ($imp) {
if ($imp->server != 'example.com') { return $imp->user; }
$cmd = '/usr/local/bin/ph unix=' . escapeShellCmd($imp->user) . ' |
/bin/grep email | /usr/bin/awk \'{print $2}\'';
$name = `$cmd`;
return (empty($name) ? $imp->user : $name);
} // imp_expand_fromaddress()
// Should we save copies of every message that is sent?
$default->save_sent_mail = false;
// What folder should we save sent messages to? This is relative to
// both $default->folders and $default->personal_folders.
//
// Ex: if you
// are using UW, and the sent-mail box is $HOME/mail/sent-mail, and
// $default->folders = 'mail/', then this should be set to
// 'sent-mail'. If $default->folders were empty, then this would have to
be 'mail/sent-mail'.
//
// For Cyrus, if both $default->folders and $default->personal_folders
// are empty, this should probably be 'INBOX.sent-mail'. However, if
// you set $default->personal_folders to 'INBOX.', then this can
// safely be just 'sent-mail'.
$default->sent_mail = 'sent-mail';
// What folder should we save postponed messages in? This is also
// relative to $default->folders and $default->personal_folders, and
// everything said above about $default->sent_mail applies.
$default->postponed = 'drafts';
// How should we prefix quoted lines in a reply?
$default->quote_prefix = '> ';
/**
** Viewing Attachments Configuration
**/
// Should we show all text parts inline (ie, in the main message
// view)?
$default->text_parts_inline = true;
// Should we include parts that are shown inline in the parts list
// table?
$default->inline_in_parts_list = false;
// how big a part can be (in k) before we won't display it inline. 0
// means no size limit.
// ON LIMITE A 100KO LES PIECES JOINTES A AFFICHER ... SI PLUS ON
AFFICHE PAS
$default->text_inline_size = 100;
// Include a link in the parts list to view the raw message?
$default->view_message_source = true;
/**
** Debugging and Logging Configuration
**/
// The value to set error_reporting() to. Valid values are: E_ERROR,
// E_WARNING, E_PARSE, E_NOTICE, E_CORE_ERROR, E_CORE_WARNING,
// E_ALL. See http://www.php.net/manual/function.error-reporting.php
// for more information.
$default->error_level = E_ALL; /* level of
error_reporting() */
// If we need to perform a long operation, what should we set
// max_execution_time to (in seconds)? 0 means no limit; however, a
// value of 0 will cause a warning if you are running in safe
// mode. See http://www.php.net/manual/function.set-time-limit.php for
// more information.
$default->max_execution_time = 0; /* number to set exec time to
for long operations */
// Should we log statistics using syslog?
$default->log_stats = false;
// If so, what log facility should we send the messages to?
$default->log_stats_facil = LOG_LOCAL4;
// What priority should be used?
$default->log_prio = LOG_NOTICE;
// What identifier should we send?
$default->log_ident = 'IMP';
// Should we log logins (and login failures)?
$default->log_auth = true;
// If so, what facility should we log them on?
$default->log_auth_facil = LOG_AUTH;
/**
** New Mail Checking Configuration
**/
// Should we check for new mail, and throw up a javascript alert if
// there is some?
$default->newmail_popup = true;
// If so, how often (in seconds) should we check?
$default->refresh_delay = 300;
/**
** Internationalization and Language Configuration
**/
// The langauge to fall back on if we cannot determine one any other
// way (user choice, preferences, HTTP_ACCEPT_LANGUAGE).
$default->language = 'fr';
// Should the user be given a menu of language options? true = yes,
// false = no.
$default->user_change_language = true;
// What format string should we pass to strftime() for messages sent on
// days other than today?
$default->date_format = '%Y-%m-%d';
// What format string should we pass to strftime() for messages sent
// today?
$default->time_format = '%I:%M %p';
// What format string should be pass to strftime() for the heading of
the
// compose window?
$default->compose_date_format = '%c';
/**
** Preferences, Addressbook, Contacts, and LDAP Configuration
**/
// Should users be able to change their from address? If preferences
// are enabled, then setting this to true will allow users to change
// the reply-to address stored in preferences. In any case, it will
// make the From: line when composing an email editable.
$default->user_change_from = true;
// Should users be allowed to change the fullname stored in
// preferences? This is only relevant if preferences are enabled.
$default->user_change_fullname = true;
// Should we display the contacts link on the menu? Setting this to
// false will allow you to let users bring up the ldap window from
// compose screens, but no where else. It is probably best to leave it
// true.
$default->menu_contacts_link = true;
// Should we allow users to use the addressbook? For this to have any
// effect, you must be using a non-dummy database driver to store the
// addresses in.
$default->user_use_addressbook = false;
// Allow LDAP searching? If you enable this, you will need to
// configure at least one LDAP server in config/ldap.php3.
$default->use_ldap_search = false;
// Hide deleted messages from the mailbox listing?
$default->hide_deleted = false;
/**
** Password Change Configuration
**/
// Should we display a password change link? false means don't display
// a link; any other link will be assumed to be the address of a page
// that provides the opportunity to change your password. One
// possibility is 'poppassd.php3', which would link to the poppasswd
// script included with IMP. Another possibility is for this to be a
// fully-qualified URL pointing to an SSL webserver providing
// password-changing capability.
$default->change_password = false;
// What server should poppassd.php3 attempt to connect to?
$default->poppassd_server = '/dev/null';
// What port should poppassd.php3 attempt to connect on (106 is
// standard)?
$default->poppassd_port = '0';
/**
** Database Configuration
**/
// What database_driver should we use? Valid options are: dummy,
// pgsql, mysql, informix oracle, or sybase.
$default->database_driver = 'mysql';
// What username should we use to connect to the database server?
$default->db_user_name = 'hordemgr';
// What password should we use to connect to the database server?
$default->db_password = '*********';
// Should we warn about a default password security hole?
$default->db_security_nag = true;
// What is the name of the database that we should use?
$default->db_name = 'horde';
// What server is the database on?
$default->db_server_name = 'localhost';
// What is the name of the table where preferences are stored?
$default->db_pref_table = 'imp_pref';
// What is the name of the table where contacts are stored?
$default->db_address_table = 'imp_addr';
// If the database is on a non-standard port, what is it?
$default->db_server_port = '';
/**
** Utility Programs Configuration
**/
// Where does sendmail live? We need this to send email.
$default->path_to_sendmail = '/usr/sbin/sendmail';
// If ispell is available, then we will provide a basic spelling
checker.
$default->path_to_ispell = '/usr/bin/ispell';
// If mswordview is available, then we can show msword attachments in
// the browser.
// **NOTE** For older versions of this application (e.g., 0.5.14), set
// this value to '/usr/bin/mswordview -o -' (note the arguments).
$default->path_to_mswordview = '/usr/local/bin/wvHtml';
// If xlHtml is available, then we can show Excel attachments in the
browser
$default->path_to_xlHtml = '/usr/local/bin/xlHtml';
// If tar is available, we can show a listing of the contents of tar
// format attachments.
$default->path_to_tar = '/bin/tar';
// If zipinfo is available, we can show a listing of the contents of
// zip file attachments.
$default->path_to_zipinfo = '/usr/bin/zipinfo';
// Path to rpm and dpkg so that packaging info can be listed for rpm
// or dpkg attachments. These will only be useful if you use Debian
// or Red Hat; mostly by default they are commented out. You must
// uncomment the appropriate lines in config/mime.php3
// $default->path_to_rpm = '/usr/bin/rpm';
// $default->path_to_dpkg = '/usr/bin/dpkg';
?>
-------- MIME.PHP3 -----------
<?php
/*
File: config/mime.conf
$Author: bjn $
$Revision: 1.1.2.14 $
$Date: 2000/08/23 01:57:39 $
IMP: Copyright 1998 Patrick C. Audley <paudley@blackcat.ca>
1999 The Horde Project <dev@horde.org>
This code is under the GNU Public License
See the file COPYING in this directory
*/
/* MIME Type Configuration
*
* This file allows you to configure site-specific MIME types, and
* control how HTML email is rendered by IMP. Please read the comments
* carefully if you change it. */
/* If you would like IMP to handle HTML email, please examine the last 3
examples */
/* If you're adding your own type, each entry is an array, and here
* are what the parts control:
*
* $mime_actions['type/subtype'] tells the MIME engine what type the
array is for
*
* 'action': Determines whether a special driver needs to be
called for this type.
* These drivers are implemented in the mimetypes.lib
file. Usually 'default'.
*
* 'view': Determines whether the MIME type is viewable in a
stand-alone window
* (This is useful for large things like Word
documents via mswordview)
*
* 'inline': Determines whether IMP should display the type in
the main message window
* (This is useful for images or HTML or other small
things)
*
* 'override_text': Determines if this MIME-type will display *in place
of* other MIME types.
* This option is not necessarily safe, but can be
used well for things like
* displaying HTML parts of email without the non-Rich
part. (optional)
*
* 'download': Determines whether the MIME-type is separately
downloadable from IMP
* (This is useful for almost everything, like
documents, etc)
*
* 'icon': Which icon to use for this MIME-type, icons in
<imphome>/graphics (optional)
*
* 'view_function': The name of any special MIME-driver needed to view
this MIME-type (optional)
*
* 'function': The name of any special MIME-driver needed to
download this MIME-type.
* This is required only if 'action' is set to
'function'.
*/
/* For example, The first function is a generic text formatter. It
* will take a MIME type that is actually text (like application/pgp)
* and format it.
*
* The second function below display all gifs/jpgs that are 10k or
* smaller.
*
* The third function will display word attachments if you have
* mswordview. */
/********* The last section controls HTML-mail behavior *********** */
$mime_actions['application/pgp'] =
array(
'action' => 'default',
'view' => true,
'inline' => true,
'view_function' => 'mime_view_text',
'download' => true,
'icon' => 'mime_text.gif'
);
$mime_actions['application/octet-stream/delivery-status'] =
array(
'action' => 'default',
'view' => true,
'inline' => true,
'view_function' => 'mime_view_text',
'download' => true,
'icon' => 'mime_mail.gif'
);
$mime_actions['application/octet-stream/rfc822'] =
array(
'action' => 'default',
'view' => true,
'inline' => true,
'view_function' => 'mime_view_text',
'download' => true,
'icon' => 'mime_mail.gif'
);
$mime_actions['application/pdf'] =
array(
'action' => 'default',
'view' => true,
'inline' => false,
'download' => true,
'icon' => 'mime_pdf.gif'
);
$mime_actions['message/rfc822'] =
array(
'action' => 'default',
'view' => true,
'inline' => false,
'view_function' => 'mime_view_text',
'download' => true,
'icon' => 'mime_mail.gif'
);
$mime_actions['message/'] =
array(
'action' => 'default',
'view' => true,
'inline' => true,
'view_function' => 'mime_view_text',
'download' => true,
'icon' => 'mime_mail.gif'
);
$mime_actions['text/'] =
array(
'action' => 'default',
'view' => true,
'inline' => true,
'view_function' => 'mime_view_text',
'download' => true,
'icon' => 'mime_text.gif'
);
$mime_actions['image/'] =
array(
'action' => 'default',
'function' => 'mime_action_images',
'view' => true,
'download' => true,
'icon' => 'mime_image.gif'
);
if (!empty($default->path_to_mswordview)) {
$mime_actions['application/msword'] =
array(
'action' => 'default',
'view' => true,
'view_function' => 'mime_view_msword',
'download' => true,
'icon' => 'mime_msword.gif'
);
}
if (!empty($default->path_to_xlHtml)) {
$mime_actions['application/msexcel'] =
array(
'action' => 'default',
'view' => true,
'view_function' => 'mime_view_xls',
'download' => true,
'icon' => 'mime_excel.gif'
);
$mime_actions['application/vnd.ms-excel'] =
array(
'action' => 'default',
'view' => true,
'view_function' => 'mime_view_xls',
'download' => true,
'icon' => 'mime_excel.gif'
);
}
$mime_actions['application/x-imp-data'] =
array(
'action' => 'function',
'function' => 'mime_action_ximpdata',
'view' => false,
'download' => false,
'icon' => 'mime_broken.gif'
);
$mime_actions['application/x-gtar'] =
array(
'action' => 'default',
'view' => true,
'view_function' => 'mime_view_tgz',
'download' => true,
'icon' => 'mime_compressed.gif'
);
$mime_actions['application/x-tar'] =
array(
'action' => 'default',
'view' => true,
'view_function' => 'mime_view_tar',
'download' => true,
'icon' => 'mime_compressed.gif'
);
/*** User-contributed mimetypes for various kinds of data. Uncomment
them if you want them. ***/
// .zip - Uses zipinfo.
// By: Joao Pedro Goncalves <joaop@iscsp.utl.pt>
// Define $default->path_to_zipinfo in defaults.php3.
$mime_actions['application/zip'] =
array(
'action' => 'default',
'view' => true,
'view_function' => 'mime_view_zip',
'download' => true,
'icon' => 'mime_compressed.gif'
);
$mime_actions['application/x-zip-compressed'] =
array(
'action' => 'default',
'view' => true,
'view_function' => 'mime_view_zip',
'download' => true,
'icon' => 'mime_compressed.gif'
);
// .rpm - Red Hat packages.
// By: Joao Pedro Goncalves <joaop@iscsp.utl.pt>
// Define $default->path_to_rpm in defaults.php3.
$mime_actions['application/x-rpm'] =
array(
'action' => 'default',
'view' => true,
'view_function' => 'mime_view_rpm',
'download' => true,
'icon' => 'mime_rpm.gif'
);
// .deb - Debian packages.
// Define $default->path_to_dpkg in defaults.php3.
$mime_actions['application/x-debian-package'] =
array(
'action' => 'default',
'view' => true,
'view_function' => 'mime_view_deb',
'download' => true,
'icon' => 'mime_deb.gif'
);
/***** HTML Email Configuration *****/
// There are multiple ways to configure IMP to view HTML sent as
// email. Here are three. It is VERY IMPORTANT to note that if you
// configure HTML to be viewed inline and set 'override_text' to true,
// it will attempt to OVERRIDE the text part of the email and replace it
// with the HTML part. This follows the behavior of most "Rich" email
// clients that send HTML mail with a text and HTML part that are
// identical except for the markup (aka multipart/alternative, but we
don't
// implement _quite_ that yet).
// Viewing HTML is NOT SECURE - it can open you to attack. For
// this reason, you can *choose* to view it, but it won't display in imp
at
// all unless you change the settings.
// Thus, the default is to only allow html parts to be downloadable, and
not
// viewable through IMP at all. This is for security reasons; please try
and
// understand those reasons before enabling any sort of HTML viewing.
$mime_actions['text/html'] =
array(
'action' => 'default',
'view' => false,
'inline' => false,
'override_text' => false,
'view_function' => 'mime_view_html',
'download' => true,
'icon' => 'mime_html.gif'
);
// Allow the HTML MIME-part to be viewed in another browser window and
// downloadable. This is the safest way to read mail and
// still have HTML mail renderable, all options are open.
// THIS IS STILL A POTENTIAL SECURITY HOLE
$mime_actions['text/html'] =
array(
'action' => 'default',
'view' => true,
'inline' => false,
'override_text' => false,
'view_function' => 'mime_view_html',
'download' => false,
'icon' => 'mime_html.gif'
);
// View the HTML MIME-part inline, overriding the text part, and be
// downloadable. This is not provably 100% safe (you may lose text).
//
// This is not secure, unfortunately, and should only be used if you
// can trust your incoming mail.
/*
$mime_actions['text/html'] =
array(
'action' => 'default',
'view' => true,
'inline' => true,
'override_text' => true,
'view_function' => 'mime_view_html',
'download' => true,
'icon' => 'mime_html.gif'
);
*/
// This is my (mikeh@spark.com) favorite - HTML inline, not
// downloadable. Overrides text parts. Totally transparent. This is
// just like the previous one, but the user interface is less
// cluttered without the download option. There is the potential
// danger that we lose some text parts when we do this, but current
// HTML-email clients send the email in such a way that this doesn't
// happen as far as I know.
//
// Unfortunately, this is not secure. Unless you only get trusted mail,
(like an
// intranet, where I have my IMP), you shouldn't use this.
/*
$mime_actions['text/html'] =
array(
'action' => 'default',
'view' => true,
'inline' => true,
'override_text' => true,
'view_function' => 'mime_view_html',
'download' => false,
'icon' => 'mime_html.gif'
);
*/
?>
-----END ------