Previous Configure Database Mail Manual Configuration Configure SQL Instance General Properties Next

Configure SQL Mail

FineBuild can Configure SQL Mail for use by SQL Server Agent.

The Database Mail functionality is used by the SQL Server Agent instance. It uses legacy MAPI to send and receive mail.

SQL Mail is not available in SQL 2012 and above, and should only be used in earlier versions if are legacy routines that still call the xp_sendmail routine. All code should be converted to use Database Mail with sp_send_dbmail instead of xp_sendmail.

If SQL Mail is required, the configuration within FineBuild is split into two parts. The current part will enable the SQL Mail procedures and set some registry values. The second part creates the Outlook mail profile for the SQL Server service account, as described in Configure Outlook Mail Profile in the Reference Manual.

SQL Server must be running using a Domain service account for SQL Mail to be configured.

FineBuild Configure SQL Mail

The SQL Mail configuration relates to Process Id 5BC and is controlled by the parameters below:

Parameter Build SQL2005 SQL2008 SQL2008 R2 SQL2012 SQL2014
SetupSQLMail FULL Yes Yes Yes N/A N/A
SetupSQLMail WORKSTATION Yes Yes Yes N/A N/A
SetupSQLMail CLIENT N/A N/A N/A N/A N/A

In order to maintain compatibility with older versions of SQL FineBuild, the parameter ConfigSQLMail can also be used.

FineBuild also uses the following parameters to help configure SQL Mail:

Parameter Default Value Description
Mailserver see text Name of the Mail Server to be used. This will default to the nearest Exchange Server in the Domain if one can be found.

Top

Manual Configure SQL Mail

The following steps show what you would have to do for manual SQL Mail configuration. FineBuild does all of this work for you automatically.

1) Use SQL Server Management Studio to run the following command to enable the use of SQL Mail:
SP_Configure 'SQL Mail XPs', '1' 

2) Some fixes should be applied to improve SQL Mail stability

Stephen Griffin, a renowned Microsoft Engineer, strongly advises that some registry patches are made to improve the stability of SQL Mail. For details see http://blogs.msdn.com/b/stephen_griffin/archive/2007/12/28/sqlmail-hates-mapi.aspx.
Open the Registry Editor by Start -> Run and type regedit to apply the following patches:
regedit.png
3) The fix described in KB329375 should be applied. For the default instance navigate to:
HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQLServer\
Create a new DWORD value called MAPI_NO_MAIL and set it to 1.
4) The fix described in KB839405 should be applied. For the default instance navigate to:
HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQLServer\
Create a new DWORD value called MAPIInitializeFlags and set it to hex 1001 (decimal 65537).
Copyright © 2013 - 2014 Edward Vassie. License and Acknowledgements
Previous Configure Database Mail Top Configure SQL Instance General Properties Next

Last edited Nov 4, 2014 at 1:29 PM by EdVassie, version 5