<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>sysmail_add_profile_sp &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/sysmail_add_profile_sp/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Sun, 29 Apr 2018 17:59:27 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.6</generator>
	<item>
		<title>SQL Server: Script to configure the Database Mail</title>
		<link>https://www.dbrnd.com/2018/05/sql-server-script-to-configure-the-database-mail/</link>
					<comments>https://www.dbrnd.com/2018/05/sql-server-script-to-configure-the-database-mail/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Tue, 01 May 2018 16:16:58 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server DBA Script]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database mail]]></category>
		<category><![CDATA[Database Mail XPs]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Mail Profile]]></category>
		<category><![CDATA[sql mail]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Error]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tuning]]></category>
		<category><![CDATA[SQL Server Programming]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[sysmail_add_profile_sp]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=7514</guid>

					<description><![CDATA[In this Post, I am sharing all necessary scripts for configuring the Database Mail in SQL Server. SQL Server provides a very good feature like Database Mail which we can use for sending the query result via email address. You can configure database mail using SSMS, but here I am sharing required T-SQL scripts. Execute [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F05%2Fsql-server-script-to-configure-the-database-mail%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20configure%20the%20Database%20Mail" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F05%2Fsql-server-script-to-configure-the-database-mail%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20configure%20the%20Database%20Mail" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F05%2Fsql-server-script-to-configure-the-database-mail%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20configure%20the%20Database%20Mail" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F05%2Fsql-server-script-to-configure-the-database-mail%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20configure%20the%20Database%20Mail" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F05%2Fsql-server-script-to-configure-the-database-mail%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20configure%20the%20Database%20Mail" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F05%2Fsql-server-script-to-configure-the-database-mail%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20configure%20the%20Database%20Mail" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F05%2Fsql-server-script-to-configure-the-database-mail%2F&#038;title=SQL%20Server%3A%20Script%20to%20configure%20the%20Database%20Mail" data-a2a-url="https://www.dbrnd.com/2018/05/sql-server-script-to-configure-the-database-mail/" data-a2a-title="SQL Server: Script to configure the Database Mail"></a></p><p>In this Post, I am sharing all necessary scripts for configuring the Database Mail in SQL Server.<br />
SQL Server provides a very good feature like Database Mail which we can use for sending the query result via email address. </p>
<p>You can configure database mail using SSMS, but here I am sharing required T-SQL scripts.</p>
<p><strong>Execute the below list of T-SQL scripts and configure the Database Mail:</strong></p>
<p><strong>Enable database mail:</strong></p>
<pre class="crayon-plain-tag">USE master;
GO

sp_CONFIGURE 'show advanced', 1
GO
RECONFIGURE
GO
sp_CONFIGURE 'Database Mail XPs', 1
GO
RECONFIGURE
GO</pre> </p>
<p><strong>Create a db main account for Gmail:</strong></p>
<pre class="crayon-plain-tag">EXECUTE msdb.dbo.sysmail_add_account_sp
@account_name = 'DB_Email_Account',
@email_address = 'test@gmail.com',
@mailserver_name = 'smtp.gmail.com',
@port=587,
@enable_ssl=1,
@username='emailaddress',
@password='password'</pre> </p>
<p><strong>Create a profile:</strong></p>
<pre class="crayon-plain-tag">EXECUTE msdb.dbo.sysmail_add_profile_sp
@profile_name = 'SQLMailProfile',
@description = 'DB Mail Service for SQL Server'</pre> </p>
<p><strong>Add account to the profile:</strong></p>
<pre class="crayon-plain-tag">EXECUTE msdb.dbo.sysmail_add_profileaccount_sp
@profile_name = 'SQLMailProfile',
@account_name = 'DB_Email_Account',
@sequence_number =1 ;</pre> </p>
<p><strong>Grant access to the profile:</strong></p>
<pre class="crayon-plain-tag">EXECUTE msdb.dbo.sysmail_add_principalprofile_sp
@profile_name = 'SQLMailProfile',
@principal_id = 0,
@is_default = 1</pre> </p>
<p><strong>Test database mail:</strong></p>
<pre class="crayon-plain-tag">EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'SQLMailProfile',
@recipients = 'xyz@abc.com',
@body = 'SQL Database Mail Test',
@subject = 'Databas Mail from dbrnd'</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2018/05/sql-server-script-to-configure-the-database-mail/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
