This post is about sending mail through SQL Server [Database Mail feature in SSMS]
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-NX3wC0-HtNzejEOR51L99lgm36FJc3clIJWHA2N0_-2tBU9eCCrNcGD2hgSDblkfdaeuXcQOhPIUuS5STsOtzbZZn3vDV7Poj1oXe92_cktuazXsX0b7A2b6cpcG9ZkD5_zhddz7VGjy/s640/m1.JPG)
select the option to create profile & account for sending mail.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmOOn6HOLuHSuf4HnCyGKVT7YZI4REKloEBS7oJwugb6Coatg8Dk15BdSeCBVQOjf7SuUvo4fwmMx77v-zROKieiUQGh7eKYiIZ6Hvx1UkE6EBc0WCFJ5o5m4iWrgS7jBcyLaTVwSpuZWb/s640/m2.JPG)
Add profile & account for sending mail
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbfEUm3vXIL63mwOdx2m1Gf-LjbWgtp9XHSdi1-r5u79AwWBgKNrY0Nvhn004xKKIR_IAe7L_F-RohrzTPlOs4JeTT2yG6WHdZTVtfbpxRVfP0PfJn8JbvEC0k8ZaCgcGAWcA_tbIInTG2/s640/m3.JPG)
gmail -> Server name - smtp.gmail.com , Port number - 587
live -> Server name - smtp.live.com , Port number - 25
Configure Maximum File Size,if your adding attachmments with mail
Management - > Database Mail - > View Database Mail Log -> to check status of your sent mail
Log into your Gmail & check for mail...
Send Mail with attachment
USE msdb
EXEC sp_send_dbmail @profile_name='MSSQLNotification',select the option to create profile & account for sending mail.
Add profile & account for sending mail
gmail -> Server name - smtp.gmail.com , Port number - 587
live -> Server name - smtp.live.com , Port number - 25
Configure Maximum File Size,if your adding attachmments with mail
Management - > Database Mail - > Send Test E-mail...
Management - > Database Mail - > View Database Mail Log -> to check status of your sent mail
Log into your Gmail & check for mail...
@recipients='sql@mssql.com',
@subject='Mail with Attachment',
@body='Please find the attachmentc',
@file_attachments='C:\temp\SQL.jpg'
Below are the system tables related to database mail.
USE msdb
SELECT * FROM dbo.sysmail_account
SELECT * FROM dbo.sysmail_attachments
SELECT * FROM dbo.sysmail_attachments_transfer
SELECT * FROM dbo.sysmail_configuration
SELECT * FROM dbo.sysmail_log
SELECT * FROM dbo.sysmail_mailitems
SELECT * FROM dbo.sysmail_principalprofile
SELECT * FROM dbo.sysmail_profile
SELECT * FROM dbo.sysmail_profileaccount
SELECT * FROM dbo.sysmail_query_transfer
SELECT * FROM dbo.sysmail_send_retries
SELECT * FROM dbo.sysmail_server
SELECT * FROM dbo.sysmail_servertype
No comments:
Post a Comment