...
- Set @@ProfileName = 'WB Report Scheduling'
- Set @@AccountName = 'WB Report Scheduling'
- Set @@EmailServer = '192.168.2.1'
- Set @@EmailAddress = 'john.doe@domain_name.com'
- Set @@ReplyAddress = 'john.doe@domain_name.com'
...
- EXECUTE msdb.dbo.sysmail_add_account_sp
- @account_name = @@AccountName
- @description = 'Workbench Report Scheduler Email Account'
- @email_address = @@EmailAddress
- @replyto_address = @@ReplyAddress
- @display_name = 'Workbench Report Scheduler'
- @mailserver_name = @@EmailServer
END
OTHERWISE
EXECUTE
- msdbEXECUTE msdb.dbo.sysmail_add_account_sp sp
- @account_name = @@AccountName
- @description = 'Workbench Report Scheduler Email Account'
- @email_address = @@EmailAddress
- @replyto_address = @@ReplyAddress
- @display_name = 'Workbench Report Scheduler'
- @mailserver_name = @@EmailServer
- @username = @@Username
- @password = @@Password ; – Add the account to the profile
EXECUTE
- msdbEXECUTE msdb.dbo.sysmail_add_profileaccount_sp sp
- @profile_name = @@ProfileName
- @account_name = @@AccountName
- @sequence_number =1
...
- EXECUTE msdb.dbo.sysmail_add_principalprofile_sp
- @profile_name = 'SQL2005_Email_ProfileName'
- @principal_id = 0,
Make Sure sure you change the values in the section with the "Set Statements" to valid settings, you can leave the first two if you like.
...