Contents Index xp_startsmtp system procedure xp_stopmail system procedure

ASA SQL Reference
  System Procedures and Functions
    System extended stored procedures
      Extended stored procedures for MAPI and SMTP

xp_sendmail system procedure

Function 

Sends an e-mail message.

Syntax 

[ [ variable = ] CALL ] xp_sendmail (

recipient = mail-address

[, subject = subject ]

[, cc_recipient = mail-address ]

[, bcc_recipient = mail-address ]

[, "message" = message-body ]

[, include_file = file-name ]

)

Permissions 

Must have executed xp_startmail to start an e-mail session under MAPI, or xp_startsmtp to start an e-mail session under SMTP.

Not supported on NetWare.

Description 

xp_sendmail is a system stored procedure that sends an e-mail message to the specified recipients once a session has been started with xp_startmail. The procedure accepts messages of any length.

The argument values are strings. The length of each argument is limited only by the amount of available memory on your system. The message parameter name requires double quotes around it because MESSAGE is a keyword.

xp_sendmail over SMTP does not support attachments.

Return codes 

The xp_sendmail system procedure issues one of the following return codes:

MAPI return codes 
Return code Meaning
0 Success.
5 Failure (general).
11 Ambiguous recipient.
12 Attachment not found.
13 Disk full.
14 Failure
15 Insufficient memory.
16 Invalid session.
17 Text too large.
18 Too many files.
19 Too many recipients.
20 Unknown recipient.
21 Login failure.
22 Too many sessions.
23 User abort.
24 No MAPI.
25 No startmail.
SMTP return codes 
Return code Meaning
0 Success.
100 Socket error.
101 Socket timeout.
102 Unable to resolve the SMTP server hostname.
103 Unable to connect to the SMTP server.
104 Server error; response not understood. (For example, the message is poorly formatted, or the server is not SMTP).
421 <domain> service not available, closing transmission channel.
450 Requested mail action not taken: mailbox unavailable.
451 Requested action not taken: local error in processing.
452 Requested action not taken: insufficient system storage.
500 Syntax error, command unrecognized. (This may include errors such as a command that is too long.)
501 Syntax error in parameters or arguments.
502 Command not implemented.
503 Bad sequence of commands.
504 Command parameter not implemented.
550 Requested action not taken: mailbox unavailable. (For example, the mailbox is not found, there is no access, or no relay is allowed.)
551 User not local; please try <forward-path>
552 Request mail action aborted: exceeded storage allocation.
553 Requested action not taken: mailbox name not allowed. (For example, the mailbox syntax is incorrect.)
554 Transaction failed.
Example 

The following call sends a message to the user ID Sales Group containing the file prices.doc as a mail attachment:

CALL xp_sendmail(recipient='Sales Group',
      subject='New Pricing',
      include_file = 'C:\\DOCS\\PRICES.DOC'
      )

Contents Index xp_startsmtp system procedure xp_stopmail system procedure