You configure SQL Server Maintenance Plan and set it to e-mail you when the job is complete. When you check the job history, you notice that it fails to send the e-mail and the following message is logged:
Could not generate mail report.An exception occurred while executing a Transact-SQL statement or batch.No global profile is configured. Specify a profile name in the @profile_name parameter.
Configure your Database Mail settings.
- Open SQL Server Management Studio
- Connect to your SQL instance -> Management
- Right click on Database Mail -> Configure Database Mail -> Next
- Select the option to ‘Set up Database Mail by performing the following tasks:’
- Type a Profile Name and description
- Under SMTP accounts, click Add
- Type an Account Name and Description
- Enter an e-mail address to send from:
- Enter a display name to send from:
- Enter your Reply-email address (optional)
- Enter your SMTP server name
- Select Windows Authentication using Database Engine service credentials (If you are using Windows authentication). Otherwise, select the option that suits your environment.
- Click OK to save your settings
- Under Public profile, set your newly created profile to both Public and default.
- Click Next and finish the wizard.
- Now right click on Database Mail again and select Send Test E-mail. Send an e-mail to yourself to ensure that your e-mail notifications are working properly.