Is mail started?

  • 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?

  • have a look at xp_stopmail!!!!


    * Noel

  • I do not want to stop mail if it is running!

  • 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

  • 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.

  • 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