How do I temporarily disable sp_send_dbmail?
USE msdb
GO
EXECUTE dbo.sysmail_stop_sp
GO
Will stop the server from sending mail. EXECUTE dbo.sysmail_start_sp
will start up the service again.
Assuming you're sending the messages from within a few stored procedures, I'd recommend checking the database name before sending the message, and skipping that step if it's not the production database. It usually looks something like this:
IF DB_NAME() = 'production_db_name'
--Do stuff, like sending mail
END IF
Then it will automatically skip the mailing if you're running it from the test database.
Couple of things come to mind.
You could just remove the MAPI profile from the test server. That won't allow xp_sendmail to run - it needs MAPI to work.
Otherwise, you could put a test SMTP server on the network and point your server at that and have it trap the emails. That way you have the emails, but they don't go out to the customers. More work than the other option though.