sysmail_configure_sp (Transact-SQL)
Changes configuration settings for Database Mail. The configuration settings specified with sysmail_configure_sp apply to the entire SQL Server instance.
Database Mail uses the following parameters:
Parameter name | Description | Default Value |
AccountRetryAttempts | The number of times that the external mail process attempts to send the e-mail message using each account in the specified profile. | 1 |
AccountRetryDelay | The amount of time, in seconds, for the external mail process to wait between attempts to send a message. | 5000 |
DatabaseMailExeMinimumLifeTime | The minimum amount of time, in seconds, that the external mail process remains active. When Database Mail is sending many messages, increase this value to keep Database Mail active and avoid the overhead of frequent starts and stops. | 600 |
DefaultAttachmentEncoding | The default encoding for e-mail attachments. | MIME |
MaxFileSize | The maximum size of an attachment, in bytes. | 1000000 |
ProhibitedExtensions | A comma-separated list of extensions which cannot be sent as an attachment to an e-mail message. | exe,dll,vbs,js |
LoggingLevel | Specify which messages are recorded in the Database Mail log. Possible values are 1, 2, or 3.
| 2 |
The stored procedure sysmail_configure_sp is in the msdb database and is owned by the dbo schema. The procedure must be executed with a three-part name if the current database is not msdb.
A. Setting Database Mail to retry each account 10 times
The following example shows setting Database Mail to retry each account ten times before considering the account to be unreachable.
EXECUTE msdb.dbo.sysmail_configure_sp
'AccountRetryAttempts', '10' ;
B. Setting the maximum attachment size to two megabytes
The following example shows setting the maximum attachment size to 2 megabytes.
EXECUTE msdb.dbo.sysmail_configure_sp
'MaxFileSize', '2097152' ;

