There are two functions that you may want to use kmail for in open office
Clicking a mailto: link in a document and launching kmail with the address inserted into the To: field
Attaching a document to an email usign the "File --> Send --> Document as email..." command
Openoffice
provides a menu under "Tools --> Options --> OpenOffice.org -->
External Programs" to allow setting an external email program.
Because of incompatible command lines passed to kmail you can't send the command directly to kmail but you need to create and specify a shell script to parse the commands before they reach kmail and change them into a format that kmail can handle.file:///home/james/Mail/kmail
When clicking a mailto: link the following is what OpenOffice passes to the external program (on one line)
mailto:[email protected]?subject=Resume%20of%20James%20McDonald
When sending an attachment OpenOffice sends the following to an external program (on one line)
-compose "attachment='file:///home/james/OpenOffice.org1.0/user/temp/soffice.tmp/svcip.tmp/kmail-openoffice_0.html'"
What
kmail needs to to be able to use this command line for mailto and attachments
respectively is
/usr/bin/kmail --composer [email protected] --subject "Resume of James McDonald"
or
/usr/bin/kmail --composer [email protected]
/usr/bin/kmail --attach "/home/james/OpenOffice.org1.0/user/temp/soffice.tmp/svcip.tmp/kmail-openoffice_0.html"
#!/bin/sh
address="$@"
logfile=/home/james/Mail/openoffice-to-kmail.log
echo $@ > $logfile
if [ `echo $address | grep -q -c "attachment"` -eq 1 ] ; then
stringtochange=$address
kmailstep1=`echo $stringtochange | cut -d= -f2`
echo kmailstep1 $kmailstep1 >> $logfile
kmailstep2=`echo $kmailstep1 | sed s#^\'file://## -`
attachtokmail=`echo $kmailstep2 | sed s/\'\"$// -`
echo Atachtokmail $attachtokmail >> $logfile
/usr/bin/kmail --attach $attachtokmail
exit 0
fi
if [ `echo $address | grep -q -c "mailto:"` -eq 1 ] ; then
passtokmail=`echo $address | sed s/^mailto://`
echo passtokmail $passtokmail >> $logfile
if [ `echo $passtokmail | grep -q -c "subject"` -eq 1 ] ; then
echo inside 2nd if >> $logfile
emailaddress=`echo $passtokmail | cut -d? -f1`
subject=`echo $passtokmail | cut -d= -f2`
killspaces=`echo $subject | sed s/\%20/" "/g -`
/usr/bin/kmail --composer $emailaddress --subject "$killspaces"
else
emailaddress=$passtokmail
/usr/bin/kmail --composer $emailaddress
fi
exit 0
fi