• I don't have a script myselef, but it looks like this http://www.sqlservercentral.com/scripts/Database+Mail/100073/ can give you a rather good starting point.

    You can also create a script yourself using the [msdb].[dbo].[sysmail_add_....._sp] stored procedures. Look in BOL for how to use these procedures.

    Another option can be to (re-)create the mail setup using the wizard. Start a profiler trace to capture the commands executed by the wizard. From this trace you can extract the required commands and create your own script.

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **