Support #4922
closedXSLT saxon:send-mail
0%
Description
Hello:
I encountered an issue: [[https://www.oxygenxml.com/forum/topic22475.html]]
Is this something Saxon community can help to resolve?
Thanks!
Files
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/)
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!
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", .)
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:
- The function attempted connection to the smtp server, in a manner of speaking.
- 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!
Updated by Michael Kay over 3 years ago
- Status changed from New to Closed
Closed at customer request.
Please register to edit this issue