All files are here or you can just get the tarball of the 2 programs and one config file here
I would like to have people / programs communicate to me via Jabber and not require them to understand Jabber. Since everything can send email I thought I would write a bridge.
How it works:
There are two processes here for the two way commmunication.
1) SMTP -> Jabber is accomplished by running a program on your mail server / client that can talk to the Jabber server. It just pipes along the mail body as the body of the Jabber message and sets the "From" to a Jabber address that's really an alias for some later SMTP commands.
2) Jabber -> SMTP is accomplished by sending a jabber message to 'email@example.com' ... a service on the Jabber server (ie like Jud / Users) is keyed off by the 'jsmtp' part and sends it off to another service which processes the message and then sends it off to an SMTP server to the address 'firstname.lastname@example.org'
Pretty easy, huh? There isn't much too it. I tried to use the other jsmtp package out there but it tried to include a mail server, and I didn't need that. Let the mail server do its job and let the jabber server do its. Just make some glue.
The two programs:
The first program is the SMTP -> Jabber bridge. Its not the best from a security standpoint as you have to have it know the "smtp" username and password in order to send off email. Since anyone could find that out by looking at the code that could be considered a risk. See below for more comments.
That program is available here. You run it and pass along as STDIN your entire email message. In qmail that's done like this, if you want email sent to "email@example.com" to go to your jabber account:
cat .qmail-j | /usr/local/bin/smtptojabber.plThat's it. It looks to a .jsmtp file to see who to then send it off to, matching on the 'to' address. The file looks like this:
<jabber> <match email="username-j"> <jid>gt;username</jid> </match> <match email="username-dummy"> <jid>dummy</jid> </match> <to>gt;username</to> <defaultdomain><EXAMPLE.com>/<defaultdomain> </jabber>
Jabber -> SMTP
A little more difficult, you have to include a "service" in your jabber.xml file that looks like this:
<browse> <service type="jsmtp" jid="jsmtp.EXAMPLE.com" name="JSMTP - Jabber SMTP mail services"> <ns>jabber:iq:register</ns> </service> </browse> <service id="jsmtp"> <host>jsmtp.EXAMPLE.com</host> <accept> <ip>127.0.0.1</ip> <port>9999</port> <secret>jsmtp</secret> </accept> </service>
That's it! I'll update these docs frequently. Send me email at cwilkes-jabber @ladro.com for questions.