DaemonForums  

Go Back   DaemonForums > Miscellaneous > Guides

Guides All Guides and HOWTO's.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 8th October 2008
BSDKaffee's Avatar
BSDKaffee BSDKaffee is offline
Real Name: Jason Hale
Coffee Addict
 
Join Date: May 2008
Location: Wintersville, Ohio
Posts: 212
Thanked 36 Times in 34 Posts
Default Sending PRs through KMail

Sending Problem Reports Through KMail

If you use KMail, you may wish to send your problem reports from send-pr through KMail instead of another mail program. The advantage of this is you already have KMail setup for your outgoing mail, so there is no need to setup another mail program. Plus all of your PRs will be stored in KMail like your other outgoing mail.

This guide has been developed for usage with FreeBSD's send-pr program, but will most likely work with any program that outputs an email message. I developed this guide mostly because it took me a while to figure out how to do this in KDE4 because it uses DBUS (which I'm not real familiar with). I have been doing this in KDE3 for a while, however.

Use the send-pr program as normal and follow the below instructions.

Intermediary Script
The following shell scripts will act as an interface between send-pr and KMail. I have provided a script for KDE 3.x and one for KDE 4.x. Be sure to use the correct one as KDE 3.x uses DCOP for communication and KDE 4.x uses DBUS. Both scripts are attached for convenience; you may save them anywhere you wish. I will use ~/src/scripts/ as an example.

KDE 3.x Script:
Code:
#!/bin/sh

# sendprbykmail-kde3.sh
# Send PRs from send-pr through KMail for KDE 3.x

# Location/name of temporary file
# DEFAULT: /tmp/kmail-pr-<PID>
TMPDIR="/tmp"
TMPFILE="kmail-pr-$$"

# Name of KMail mail folder used for outgoing mail
# DEFAULT: outbox
OUTBOX="outbox"

# Create a temorary file containing the output of send-pr
cat - > ${TMPDIR}/${TMPFILE}

# Check if KMail is running, if so place the PR in the outbox
if dcop kmail ; then
	dcop kmail KMailIface dcopAddMessage ${OUTBOX} ${TMPDIR}/${TMPFILE} N
	rm ${TMPDIR}/${TMPFILE}
	exit 0
else
# If KMail is not running, PR is saved
	echo "** PR not sent. Copy stored in ${TMPDIR}/${TMPFILE}"
	exit 1
fi
KDE 4.x script:
Code:
#!/bin/sh

# sendprbykmail-kde4.sh
# Send PRs from send-pr through KMail for KDE 4.x

# Location/name of temporary file
# DEFAULT: /tmp/kmail-pr-<PID>
TMPDIR="/tmp"
TMPFILE="kmail-pr-$$"

# Name of KMail mail folder used for outgoing mail
# DEFAULT: outbox
OUTBOX="outbox"

# Create a temorary file containing the output of send-pr
cat - > ${TMPDIR}/${TMPFILE}

# Check if KMail is running, if so place the PR in the outbox
if qdbus org.kde.kmail ; then
	qdbus org.kde.kmail /KMail org.kde.kmail.kmail.dbusAddMessage ${OUTBOX} ${TMPDIR}/${TMPFILE}
	rm ${TMPDIR}/${TMPFILE}
	exit 0
else
# If KMail is not running, PR is saved
	echo "** PR not sent. Copy stored in ${TMPDIR}/${TMPFILE}"
	exit 1
fi
Environment
send-pr uses the MAIL_AGENT environment variable to determine which program to use to send the PR. The default is to use sendmail. You will want to set this to the path of the script.

In sh-like shells:
$ export MAIL_AGENT=~/src/scripts/sendprbykmail-kde3.sh

In csh-like shells:
$ setenv MAIL_AGENT ~/src/scripts/sendprbykmail-kde3.sh

You may wish to add this environment variable to your ~./profile, ~./cshrc, ~./bashrc, etc. for future use.

Closing
Now you should have a PR sitting in your KMail outbox. You may have to send the queued messages in the outbox through KMail depending on how you have your outbox configured.
Attached Files
File Type: sh sendprbykmail-kde3.sh (663 Bytes, 9 views)
File Type: sh sendprbykmail-kde4.sh (695 Bytes, 10 views)
Reply With Quote
Reply

Tags
kde

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
sending 2 launcher command to terminal with && ? whispersGhost Solaris 3 24th December 2008 06:19 PM
FreeBSD 6.2 + qmail = problem sending email to freebsd.org DNAeon FreeBSD Ports and Packages 2 29th September 2008 12:27 AM
Mutt not sending email cssgalactic FreeBSD General 4 3rd July 2008 09:54 PM
System stopped sending e-mail messages. bigb89 FreeBSD General 4 30th June 2008 05:20 PM


All times are GMT. The time now is 07:10 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick