Hello Friends,
How to Configure Database Mail | How to send Email from SQL SERVER
You have to follow some simple steps to achieve this.
Step 1. Go to Object Explorer
Step 2. Expand the management menu
Step 3. Right click on database mail and select configure database mail
Step 4. Create Profile for Database Mail
Step 5. Add SMTP Account by providing Email Address, Server, Display name, Reply, Server name & SMTP Authentication Type.
This server requires a secure connection (SSL) - checked or unchecked as per your e-mail Domain.
Here, I am using my Gmail account credentials to configure the mail setup That's why we use basic authentication
Step 6. compete the configuration
We will send the parameters to “sp_send_dbmail” system procedure, as per our requirement.
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'Test Mail',
@recipients = '[email protected]',
@subject = 'DataBase Mail Test',
@body = 'This is a test e-mail.';
Here are few SMTP Server Details for your reference.
Gmail smtp.gmail.com 587
Hotmail smtp.live.com 587
Yahoo smtp.mail.yahoo.com 25
AOL smtp.aol.com 587
(Return all sent emails)
SELECT * FROM msdb.dbo.sysmail_sentitems;
if you are getting error : The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1. This specifically applied to Gmail accounts/SMTP Server.
login to your gmail account and enable 'Allow less secure Apps'
https://myaccount.google.com/lesssecu...
All you need is turn that on and try sending email again.
This video will help you understand the following concepts:
1.) What is Database Mail in sql server.
2.) How to configure the Database mail in sql server ?
3.) How to create profile and multiple accounts in database mail in sql server.
4.) How to send test email to Gmail Account from SQL SERVER with practical demo.
5.) Which are those two settings in Gmail Account you need to check before sending mail from SQL SERVER.
If you need personal help in SQL, Mock interviews, You can contact me
Regards,
IQBees
#ConfigureDatabaseMail #sql #sqlserver #SendEmailFromSqlServer