Was this page helpful?
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

sysmail_configure_sp (Transact-SQL)


Applies To: SQL Server 2014, SQL Server 2016 Preview

Changes configuration settings for Database Mail. The configuration settings specified with sysmail_configure_sp apply to the entire SQL Server instance.

Applies to: SQL Server (SQL Server 2008 through current version).

Topic link icon Transact-SQL Syntax Conventions

sysmail_configure_sp [ [ @parameter_name = ] 'parameter_name' ]
    [ , [ @parameter_value = ] 'parameter_value' ]
    [ , [ @description = ] 'description' ]

[@parameter_name = ] 'parameter_name'

The name of the parameter to change.

[@parameter_value = ] 'parameter_value'

The new value of the parameter.

[@description = ] 'description'

A description of the parameter.

0 (success) or 1 (failure)

Database Mail uses the following parameters:

Parameter name


Default Value


The number of times that the external mail process attempts to send the e-mail message using each account in the specified profile.



The amount of time, in seconds, for the external mail process to wait between attempts to send a message.



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.



The default encoding for e-mail attachments.



The maximum size of an attachment, in bytes.



A comma-separated list of extensions which cannot be sent as an attachment to an e-mail message.



Specify which messages are recorded in the Database Mail log. Possible values are 1, 2, or 3.

  • 1 - This is normal mode. Logs only errors.

  • 2 - This is extended mode. Logs errors, warnings, and informational messages.

  • 3 - This is verbose mode. Logs errors, warnings, informational messages, success messages, and additional internal messages. Use this mode for troubleshooting.


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.

Execute permissions for this procedure default to members of the sysadmin fixed server role.

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' ;
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft