A module for performing email related functions
mail:close-mail-folder($mail-folder-handle as xs:integer, $expunge as xs:boolean) as item()
Closes a mail folder.
$mail-folder-handle | The mail folder handle retrieved from mail:get-mail-folder() |
$expunge | A boolean that specifies whether to expunge the folder on close. |
mail:close-mail-store($mail-store-handle as xs:integer) as item()
Closes a mail store.
$mail-store-handle | The mail store handle retrieved from mail:get-mail-store() |
mail:close-message-list($message-list-handle as xs:integer) as item()
Closes a message list.
$message-list-handle | The message list handle retrieved from mail:get-message-list() or mail:search-message-list() |
mail:get-mail-folder($mail-store-handle as xs:integer, $foldername as xs:string) as xs:long?
Opens a mail folder.
$mail-store-handle | The mail store handle retrieved from mail:get-mail-store() |
$foldername | The name of the folder to open |
mail:get-mail-session($properties as element()?) as xs:long?
Open's a JavaMail session.
$properties? | An optional JavaMail session properties in the form <properties><property name="" value=""/></properties>. The JavaMail properties are spelled out in Appendix A of the JavaMail specifications. |
mail:get-mail-store($mail-handle as xs:integer) as xs:long?
Opens a mail store. Host/User/Password/Protocol values will be obtained from the session.
$mail-handle | The JavaMail session handle retrieved from mail:get-mail-session() |
mail:get-message-list($mail-folder-handle as xs:integer) as xs:long?
Returns a message list of all messages in a folder.
$mail-folder-handle | The mail folder handle retrieved from mail:get-mail-folder() |
mail:get-message-list-as-xml($message-list-handle as xs:integer, $include-headers as xs:boolean) as element()?
Returns a message list of all messages in a folder as XML. If there are no messages in the list, an empty sequence will be returned
$message-list-handle | The message list handle retrieved from mail:get-message-list() or mail:search-message-list() |
$include-headers | A boolean specifying whether to include message headers |
mail:get-messages($message-list-handle as xs:integer, $message-numbers as xs:integer*) as element()?
Returns a sequence of emails as XML. If there are no messages-numbers in the list, an empty sequence will be returned. Please see get_messages_example.xql.
$message-list-handle | The message list handle retrieved from mail:get-message-list() or mail:search-message-list() |
$message-numbers* | The messages to retrieve using the numbers from the message-list '//mail:message/@number' |
mail:search-message-list($mail-folder-handle as xs:integer, $search-parameters as element()) as xs:long?
Searches messages in a folder. Search terms are of the form <searchTerm type="xxx">...</searchTerm>. Valid types include: not, and, or, from, subject, body, recipient, header, flag, sent, received. <searchTerm type="not"> requires a single nested child search term. <searchTerm type="and"> and <searchTerm type="or"> must have one or more nested child search terms. <searchTerm type="from" pattern="pat">, <searchTerm type="subject" pattern="pat"> and <searchTerm type="body" pattern="pat"> require a pattern attribute and will search for a substring that matches the pattern. <searchTerm type="recipient" pattern="pat" recipientType="to|cc|bcc"> requires pattern and recipientType attributes. <searchTerm type="header" pattern="pat" name="Content-Type"> requires pattern and name attributes. <searchTerm type="flag" flag="answered|deleted|draft|recent|seen" value="true|false"> requires flag and value attributes. <searchTerm type="sent" comparison="eq|gt|ge|lt|le|ne" format="format" date="date"> and <searchTerm type="received" comparison="eq|gt|ge|lt|le|ne" format="format" date="date"> require comparison, format and date attributes. The format string should conform to Java SimpleDateFormat specifications and the date string must conform to the specified format string.
$mail-folder-handle | The mail folder handle retrieved from mail:get-mail-folder() |
$search-parameters | The xml fragment defining the search terms |
mail:send-email($mail-handle as xs:long, $email as element()+) as item()
Sends an email using javax.mail messaging libraries.
$mail-handle | The JavaMail session handle retrieved from mail:get-mail-session() |
$email+ | The email message in the following format: <mail> <from/> <reply-to/> <to/> <cc/> <bcc/> <subject/> <message> <text/> <xhtml/> </message> <attachment filename="" mimetype="">xs:base64Binary</attachment> </mail>. |
mail:send-email($email as element()+, $server as xs:string?, $charset as xs:string?) as xs:boolean+
Sends an email through the SMTP Server.
$email+ | The email message in the following format: <mail> <from/> <reply-to/> <to/> <cc/> <bcc/> <subject/> <message> <text/> <xhtml/> </message> <attachment filename="" mimetype="">xs:base64Binary</attachment> </mail>. |
$server? | The SMTP server. If empty, then it tries to use the local sendmail program. |
$charset? | The charset value used in the "Content-Type" message header (Defaults to UTF-8) |