Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 xp_sendmail question

Author  Topic 

corvalion
Starting Member

6 Posts

Posted - 2004-07-21 : 08:23:51
how can i pass a database variable to @recipients
ie so i can change the table names etc instead of changing the triger.
I am totally self taught so be gentle.

JasonGoff
Posting Yak Master

158 Posts

Posted - 2004-07-21 : 08:42:17
Assuming you are running some sort of Stored Procedure...
In the procedure you need....

DECLARE @recip VARCHAR(100) --or whatever
SELECT @recip=MyRecipientField
FROM MyTable
WHERE ... etc
exec xp_sendmail @recip,'Hello'
Go to Top of Page

corvalion
Starting Member

6 Posts

Posted - 2004-07-22 : 05:45:08
thanks worked a treat.
just one more question can you do a read receipt on it as well ?
I suspect not.
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-07-22 : 08:07:13
I don't believe you can. The xp_mail functions only work against a particular box. You can read the "unread" status of email in that box with xp_readmail, but you cannot check on status of emails you have sent out from that box. Make sense?

Also, if you plan on using this much you should look up the following in Books Online, which does a great job of explaining xp_mail functions:

xp_sendmail
xp_readmail
xp_deletemail
xp_findnextmsg
xp_startmail
xp_stopmail

There is one thing you could check out. When you send mail, you are allowed to define a "type". I'm not really sure what this is as I've never used it.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page
   

- Advertisement -