http://www.zorba-xquery.com/modules/email/smtp ZC

Module Description
Before using any of the functions below please remember to import the module namespace:
import module namespace smtp = "http://www.zorba-xquery.com/modules/email/smtp";

This module can be used for sending emails. The SMTP module contains only one public function that receives two parameters. The SMTP server access information passed as an hostInfo element and the email message representation as a message element. For a quick start see the examples associates with the send(...) function. For a complete specification read, the description and the documentation associated with this function.

Author:

Sorin Nasoi, Daniel Thomas

XQuery version and encoding for this module:

xquery version "3.0" encoding "utf-8";

Module Resources
  • the XQuery module can be found here.
Module Dependencies

Imported schemas:

External C++ library dependencies:

Namespaces
ann http://www.zorba-xquery.com/annotations
email http://www.zorba-xquery.com/modules/email
smtp http://www.zorba-xquery.com/modules/email/smtp
ver http://www.zorba-xquery.com/options/versioning
Function Summary
send ( $host-info as element(email:hostInfo), $message as element(email:message) ) as empty-sequence()
This function sends an email message from the specified account.
Functions
send back to 'Function Summary'
declare %ann:sequential function smtp:send (
            $host-info as element(email:hostInfo), 
            $message as element(email:message) 
 ) as empty-sequence()

This function sends an email message from the specified account. The hostName child element of $host-info must have the form: remote_system_name [":" port] [flags]. This syntax is part of the Remote names syntax defined in the UW IMAP toolkit. The remote_system_name and flags fragments are explained in the section III of this document. For example the hostName could look like:

  • <hostName>smtp.gmail.com:587/tls/novalidate-cert<hostName>
  • <hostName>[209.85.129.111]:587/tls/novalidate-cert<hostName>
The $host-info parameter could then look like this:
 <hostInfo>
 <hostName>smtp.gmail.com:587/tls/novalidate-cert<hostName>
 <userName>username<userName>
 <password>password<password>
 </hostInfo>
 
For a complete of the structure of an email message, see the imported email schema: http://www.zorba-xquery.com/modules/email All the data passed to this function does not need to be validated. The only requirement is that they have a valid format and are in the correct namespace according to the schema: http://www.zorba-xquery.com/modules/email.

Parameters:
  • $host-info The SMTP host, user name, and password.
  • $message The message to send as defined in the email XML schema.
Returns:
  • The function is declared as sequential and has side-effects. It returns the empty sequence.
Errors:
  • smtp:SMTP0001 The message format is invalid.
  • smtp:SMTP0002 The message has no recipient.
  • smtp:SMTP0003 The message could not be sent.
  • smtp:SMTP9999 If any other error occurs.
  • err:XQDY0027 If the values of the arguments are not not valid according to the email schema: http://www.zorba-xquery.com/modules/email
Examples:

blog comments powered by Disqus