Project

Profile

Help

Support #4922

closed

XSLT saxon:send-mail

Added by Anonymous over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Low
Category:
-
Sprint/Milestone:
-
Start date:
2021-03-01
Due date:
% Done:

0%

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

Description

Hello:

I encountered an issue:  [[https://www.oxygenxml.com/forum/topic22475.html]]

Is this something Saxon community can help to resolve?

Thanks!


Files

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

Updated by Michael Kay over 3 years ago

  • Assignee set to O'Neil Delpratt
Actions #2

Updated by O'Neil Delpratt over 3 years ago

hi,

As mentioned here: https://www.saxonica.com/html/documentation/functions/saxon/send-mail.html

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: https://javaee.github.io/javamail/)

Actions #3

Updated by Anonymous over 3 years 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? 

Thanks!

Actions #4

Updated by O'Neil Delpratt over 3 years ago

Using XSLT 3.0 see below example:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:saxon="http://saxon.sf.net/"
    exclude-result-prefixes="xs" version="3.0">
    
    <xsl:variable name="mailSetup" as="map(xs:string, xs:string)">
        <xsl:map>
            <xsl:map-entry key="'to'" select="'me@gmail.com'"/>
            <xsl:map-entry key="'from'" select="'me@gmail.com'"/>
            <xsl:map-entry key="'smtp-server'" select="'smtp.gmail.com'"/>
            <xsl:map-entry key="'username'" select="'me@gmail.com'"/>
            <xsl:map-entry key="'password'" select="'mepassword'"/>
        </xsl:map>
    </xsl:variable>
    
    <xsl:variable name="html" as="xs:string">
        <![CDATA[ <html>
            <body>
                <h1>Test saxon:send-mail</h1>
                <p>Test Ok</p>
            </body>
        </html>]]> 
    </xsl:variable>
    
    <xsl:template name="xsl:initial-template">
        <xsl:value-of select="saxon:send-mail($mailSetup, 'Test', $html, ())"/>
    </xsl:template>
    
</xsl:stylesheet>

The following in XPath 3.1 should also work:

saxon:send-mail(map{'to':'name@example.com', 'from':'support@example.com',
            'smtp-server':'smtp.example.com', 'username':'send-mail', 'password':'password, 'html':'true', 'realname':'saxon:Send-mail', 'port':'2525'}, "mail content", .)
Actions #5

Updated by Anonymous over 3 years ago

Hi,

I get a 2nd read on https://www.saxonica.com/html/documentation/functions/saxon/send-mail.html

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':'***@gmail.com', 'from':'***@gmail.com', 
        'smtp-server':'smtp.gmail.com', 'username':'***@gmail.com', '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?

Thanks!

Actions #6

Updated by Michael Kay over 3 years ago

  • Status changed from New to Closed

Closed at customer request.

Actions #7

Updated by Michael Kay over 3 years ago

  • Tracker changed from Bug to Support

Please register to edit this issue

Also available in: Atom PDF