Modify the configuration settings of database mail. UseSysmail_configure_spThe specified configuration settings apply to the entire SQL server instance.
Syntax
|
sysmail_configure_sp [ [ @parameter_name = ] 'parameter_name' ] [ , [ @parameter_value = ] 'parameter_value' ] [ , [ @description = ] 'description' ] |
Parameters
-
[
@ Parameter_name=]
'
Parameter_name
'
-
The name of the parameter to be modified.
-
[
@ Parameter_value=]
'
Parameter_value
'
-
The new value of the parameter.
-
[
@ Description=]
'
Description
'
-
Parameter description.
Return code value
0(Successful) or1(Failed)
Result set
None
Note
Database mail uses the following parameters:
Parameter Name |
Description |
Default Value |
Accountretryattempts |
The number of times the external email process attempts to send emails to each account in the specified configuration file. |
1 |
Accountretrydelay |
The wait time (in seconds) between two attempts by the external mail process ). |
5000 |
Databasemailexeminimumlifetime |
Minimum time (in seconds) for the external mail process to remain active ). If you want to send multiple emails to a database mail, adding this value can keep the database mail active to avoid overhead of frequent start and stop. |
600 |
Defaultattachmentencoding |
The default email attachment encoding. |
Mime |
Maxfilesize |
The maximum attachment size (in bytes ). |
1000000 |
Prohibitedextensions |
A group of extensions separated by commas. Files with these extensions cannot be sent as email attachments. |
EXE, DLL, vbs, JS |
Logginglevel |
Specifies the message to be logged in the database mail log. The value may be 1, 2, or 3.
- 1-Indicates normal mode. Only errors are recorded.
- 2-indicates the extended mode. Records error, warning, and information messages.
- 3-indicates the verbose mode. Record errors, warnings, informative messages, successful messages, and other internal messages. This mode is used for troubleshooting.
|
2 |
Stored ProcedureSysmail_configure_spInMSDBIn the databaseDBO
Architecture. If the current database is notMSDB, The process must be executed using a name consisting of three parts.
Permission
By default,SysAdminMembers of a fixed server role have the permission to perform this process.
Example
A. Set database emails so that they can be retried 10 times per account
In the following example, a database email is set up so that it is retried ten times for each account before being considered inaccessible.
|
Copy code |
EXECUTE msdb.dbo.sysmail_configure_sp 'AccountRetryAttempts', '10' ; |
B. Set the maximum attachment size to 2 MB.
In the following example, the maximum attachment size is set to 2 MB.
|
Copy code |
EXECUTE msdb.dbo.sysmail_configure_sp 'MaxFileSize', '2097152' ; |
See Other resources Help and information