W3C home > Mailing lists > Public > xproc-dev@w3.org > July 2012

Sending e-mails with cx:send-mail

From: Jostein Austvik Jacobsen <josteinaj@gmail.com>
Date: Wed, 18 Jul 2012 00:06:45 +0200
Message-ID: <CAOCxfQcXGPqh8SLE2OyhL8+OAzZFA4fBeC7MSWM6K_tNObXLLA@mail.gmail.com>
To: XProc Dev <xproc-dev@w3.org>
I'm trying to send a mail from XProc with cx:send-mail, but I'm having
trouble getting it working. I've read the discussion[1] that resulted in
the implementation of the experimental step, and I also found mention of it
in the Calabash configuration documentation[2], but I haven't got it
working. So here's my pipeline:

<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" xmlns:c="
http://www.w3.org/ns/xproc-step" xmlns:cx="
http://xmlcalabash.com/ns/extensions" version="1.0">
    <p:output port="result"/>
    <p:import href="http://xmlcalabash.com/extension/steps/library-1.0.xpl
    <cx:send-mail xmlns:em="URN:ietf:params:email-xml:"
        <p:input port="source">
            <p:inline exclude-inline-prefixes="em rf cx">
                    <rf:subject>Hello, world!</rf:subject>
                    <em:content type='text/plain'>Hope you are well formed.
Regards, XProc.</em:content>

(It's essentially the same as Norman's example in the earlier discussion. I
added mailto: in the adrs element since they do that in the RFC822

The thread tells me that it should be configured in ~/.calabash with:
<cc:sendmail host="outbound.mailhop.org" port="2525" username="jdoe"

The documentation tells me that it should be configured either with Java
system properties:
...or in ~/.calabash:
<cc:saxon-configuration-property host="hostname" port="portnumber"
username="name" password="password"/>

I've downloaded JavaMail and added mail.jar to the classpath for Calabash.
Setting the Java system properties or using cc:sendmail doesn't seem to do
anything; I just get the same error as if I hadn't tried to configure SMTP
at all. If I use cc:saxon-configuration-property I get "XProcException:
Configuration option 'saxon-configuration-property' cannot have a null key
or value". I've also added "<implementation type="cx:send-mail"
class-name="com.xmlcalabash.extensions.SendMail"/>" to ~/.calabash, hoping
that that would work, but nothing changed.

This is the error I get:
~$ calabash -D send-mail-test.xpl
Cannot find CatalogManager.properties
DEBUG: setDebug: JavaMail version 1.4.5
Jul 18, 2012 12:00:03 AM com.xmlcalabash.drivers.Main error
SEVERE: Pipeline failed: java.lang.NullPointerException
at javax.mail.internet.MimeMessage.setContent(MimeMessage.java:1554)
 at com.xmlcalabash.extensions.SendMail.run(Unknown Source)
at com.xmlcalabash.runtime.XAtomicStep.run(Unknown Source)
 at com.xmlcalabash.runtime.XPipeline.doRun(Unknown Source)
at com.xmlcalabash.runtime.XPipeline.run(Unknown Source)
 at com.xmlcalabash.drivers.Main.run(Unknown Source)
at com.xmlcalabash.drivers.Main.main(Unknown Source)

What am I doing wrong? And what is the right way to configure Calabash for
sending mails?

[1] http://lists.w3.org/Archives/Public/xproc-dev/2011Nov/thread.html#msg4
[2] http://xmlcalabash.com/docs/reference/configuration.html#cfg.
[3] http://tools.ietf.org/html/draft-klyne-message-rfc822-xml-03

Received on Tuesday, 17 July 2012 22:07:33 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:03:10 UTC