November 25, 2003 at 7:05 am
Some of the servers we manage have mail configured and some not. I have a generic maintenance job running on all my servers and I want to send mail only if mail is started otherwise, only send a message to the errolog. How can I check to see if mail is started - I thought of running xp_startmail, but this return 1 when it's already running and also when it can not be started.
Any ideas?
November 25, 2003 at 7:09 am
have a look at xp_stopmail!!!!
* Noel
November 25, 2003 at 7:21 am
I do not want to stop mail if it is running!
November 25, 2003 at 10:01 am
DECLARE @status int, @message_id varchar(255)
-- SET @status = value would be here.
-- SET @message_id = value would be here.
EXEC @status = xp_findnextmsg @msg_id = @message_id OUTPUT
select @status -- if @status = 0 that mean sql-mail is up. I used this to monitor all server that has sql-mail.
If sql-mail is down, this command will also start sql-mail for you.
mom
November 26, 2003 at 3:58 am
Thanks, but I need a way to check this without generating an error. I have a job step which sends mail and I do not want the step to fail if mail is not configured.
November 26, 2003 at 7:54 am
I think xp_servicecontrol might be helpful...
proy
proy
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply