Support #4922

XSLT saxon:send-mail

Added by Anonymous 7 months ago. Updated 7 months ago.

Start date:
Due date:
% Done:


Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:



I encountered an issue:  [[]]

Is this something Saxon community can help to resolve?


authentication-failure.jpg (139 KB) authentication-failure.jpg Anonymous, 2021-03-04 00:19


#1 Updated by Michael Kay 7 months ago

  • Assignee set to O'Neil Delpratt

#2 Updated by O'Neil Delpratt 7 months ago


As mentioned here:

Use of this function requires the JavaMail API. The mail.jar must be available on the classpath. 
From Saxon 9.9, the required jar is compiled against version 1.6 (previously, this was version 1.4). 
The jar is not redistributed as part of the Saxon product, but is available for download from the 
JavaMail project on GitHub.

It looks like you need the mail.jar (You can download the jar here:

#3 Updated by Anonymous 7 months ago

Hi, O'Neil:

Thanks for the quick response!  I managed to workaround the Oxygen bug. 

**BUT** I can't actually see such sent or received email.  

What is the realistic method that I can validate the saxon:send-mail functionality given this circumstance? 


#4 Updated by O'Neil Delpratt 7 months ago

Using XSLT 3.0 see below example:

<xsl:stylesheet xmlns:xsl=""
    xmlns:xs="" xmlns:saxon=""
    exclude-result-prefixes="xs" version="3.0">
    <xsl:variable name="mailSetup" as="map(xs:string, xs:string)">
            <xsl:map-entry key="'to'" select="''"/>
            <xsl:map-entry key="'from'" select="''"/>
            <xsl:map-entry key="'smtp-server'" select="''"/>
            <xsl:map-entry key="'username'" select="''"/>
            <xsl:map-entry key="'password'" select="'mepassword'"/>
    <xsl:variable name="html" as="xs:string">
        <![CDATA[ <html>
                <h1>Test saxon:send-mail</h1>
                <p>Test Ok</p>
    <xsl:template name="xsl:initial-template">
        <xsl:value-of select="saxon:send-mail($mailSetup, 'Test', $html, ())"/>

The following in XPath 3.1 should also work:

saxon:send-mail(map{'to':'', 'from':'',
            'smtp-server':'', 'username':'send-mail', 'password':'password, 'html':'true', 'realname':'saxon:Send-mail', 'port':'2525'}, "mail content", .)

#5 Updated by Anonymous 7 months ago


I get a 2nd read on

I believe saxon:send-mail demands an outgoing email server (gmail) port and ssl arguments.

I modified the mailSetup as such:

<xsl:variable name="mailSetup" select="map{'to':'***', 'from':'***', 
        'smtp-server':'', 'username':'***', 'password':'***', 'port':'465', 'ssl':true()}"/>

What did happen was:

  1. The function attempted connection to the smtp server, in a manner of speaking.
  2. authentication failed:

It begs the question if Oxygen or Saxon can honor the function in GUI : gmail usually notified the user an unsecured connection/attempt. However, I didn't receive such mail.

Assuming your codes work outside of Oxygen Editor, shall we conclude that SXJM0002 is, indeed, Oxygen bug?


#6 Updated by Michael Kay 7 months ago

  • Status changed from New to Closed

Closed at customer request.

#7 Updated by Michael Kay 7 months ago

  • Tracker changed from Bug to Support

Please register to edit this issue

Also available in: Atom PDF