http://www.zorba-xquery.com/modules/email/smtp
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.
Sorin Nasoi, Daniel Thomas
xquery version "3.0" encoding "utf-8";
- the XQuery module can be found here.
Imported schemas:
External C++ library dependencies:
| ann | http://www.zorba-xquery.com/annotations |
| http://www.zorba-xquery.com/modules/email | |
| smtp | http://www.zorba-xquery.com/modules/email/smtp |
| ver | http://www.zorba-xquery.com/options/versioning |
|
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. |
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>
$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.
- $host-info The SMTP host, user name, and password.
- $message The message to send as defined in the email XML schema.
- The function is declared as sequential and has side-effects. It returns the empty sequence.
- 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