Windows NT only Reads, processes, sends, and deletes messages in the Adaptive Server message inbox, using the xp_findnextmsg, xp_readmail, xp_sendmail, and xp_deletemail system extended stored procedures (ESPs).
sp_processmail [subject] [, originator [, dbuser [, dbname [, filetype [, separator]]]]]
is the subject header of the message. If you specify a subject but not an originator, sp_processmail processes all unread messages in the inbox that has the specified subject header. If you specify both subject and originator, sp_processmail processes all unread messages with the specified subject header sent by the specified originator. If you do not specify either subject or originator, sp_processmail processes all the unread messages in the Adaptive Server message inbox.
is the sender of an incoming message. If you specify an originator and do not specify a subject, sp_processmail processes all unread messages in the inbox sent by the specified originator.
specifies the Adaptive Server login name to use for the user context for executing the query in the message. The default is “guest.”
specifies the database name to use for the database context for executing the query in the message. The default is “master.”
specifies the file extension of the attached file that contains the results of the query. The default is “.txt”.
specifies the character to use as a column separator in the query results. It is the same as the /s option of isql. The default is the tab character.
Processes all unread messages in the Adaptive Server inbox with the subject header “SQL Report” submitted by mail user “janet”, processes the received queries in the salesdb database as user “sa”, and returns the query results to “janet” in a .res file attached to the mail message. The columns in the returned results are separated by semicolons:
sp_processmail @subject="SQL REPORT", @originator="janet", @dbuser="sa", @dbname="salesdb", @filetype="res", @separator=";"
Processes all unread messages in the Adaptive Server inbox as user “sa” in the master database and returns the query results in .txt files, which are attached to the mail messages. The columns in the returned results are separated by tab characters:
sp_processmail sends outgoing mail to the originator of the incoming mail message being processed.
sp_processmail uses the default parameters when invoking the ESPs, except for the dbuser, dbname, attachname, and separator parameters to xp_sendmail, which can be overridden by the parameters to sp_processmail.
sp_processmail processes all messages as Adaptive Server queries. It reads messages from the Adaptive Server inbox and returns query results to the sender of the message and all its cc’d and bcc’d recipients in an attachment to an Adaptive Server message. sp_processmail generates a name for the attached file consisting of “syb” followed by five random digits, followed by the extension specified by the filetype parameter; for example, “syb84840.txt.”
sp_processmail deletes messages from the inbox after processing them.
The subject and originator parameters specify which messages should be processed. If neither of these parameters is supplied, sp_processmail processes all the unread messages in the Adaptive Server message inbox.
sp_processmail does not process attachments to incoming mail. The query must be in the body of the incoming message.
Only a System Administrator can execute sp_processmail.
Extended stored procedures xp_deletemail, xp_findnextmsg, xp_readmail, xp_sendmail, xp_startmail