Created
January 30, 2014 19:34
-
-
Save ableasdale/8716999 to your computer and use it in GitHub Desktop.
MarkLogic - Amped email
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "1.0-ml"; | |
module namespace amped = "http://marklogic.com/kb/amp"; | |
declare variable $SUBJECT as xs:string := "Email from a Module"; | |
declare variable $FROM-NAME as xs:string := "MarkLogic (AMPED)"; | |
declare variable $FROM-EMAIL as xs:string := "[email protected]"; | |
declare variable $TO-NAME as xs:string := "Example Recipient"; | |
declare variable $TO-EMAIL as xs:string := "[email protected]"; | |
declare variable $EMAIL-BODY as element(div) := <div>This email was sent from an <strong>amped</strong> function</div>; | |
declare function amped:email() { | |
xdmp:email( | |
<em:Message | |
xmlns:em="URN:ietf:params:email-xml:" | |
xmlns:rf="URN:ietf:params:rfc822:"> | |
<rf:subject>{$SUBJECT}</rf:subject> | |
<rf:from> | |
<em:Address> | |
<em:name>{$FROM-NAME}</em:name> | |
<em:adrs>{$FROM-EMAIL}</em:adrs> | |
</em:Address> | |
</rf:from> | |
<rf:to> | |
<em:Address> | |
<em:name>{$TO-NAME}</em:name> | |
<em:adrs>{$TO-EMAIL}</em:adrs> | |
</em:Address> | |
</rf:to> | |
<em:content> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title>Test HTML message</title> | |
</head> | |
<body> | |
{$EMAIL-BODY} | |
</body> | |
</html> | |
</em:content> | |
</em:Message>)}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment