MSSQL - How to Setup Database Mail Step by Step

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
and this video I want to show you how to set up a database mail in sequel server 2008 so I'm going to go into sequel Server 2008 and under management there's going to be a database mail and you could go in and you could do the wizard or you could execute these commands so if I execute these commands basically configuring the database mail or the hair it's really configuring the extended store procedures here for a database mail and start the database mail but I could also go in here and I'll do the same thing now I'm going to choose configure database mail and normally it will prompt me to say yes enable database mail and I'll just click yes but since I already enabled it didn't prompt me so I'm going to go in I'm going to choose the first selection and I'm going to make a profile that's a monitor email profile and this is going to be used to monitor processes and the database sizes on the database server here so I'm going to create this specifically for doing notifications and alerts and all of that so if you notice I clicked add here to add an SMTP account so my account is going to be code cowboy org account and it's just going to be gmail.com is my email so I'm just going to use a my gmail account E and now what when you do this most likely you're going to be doing it for your company or for your website and you're going to have your own SMTP account here I'm going to put in my mail server here and I'm going to have some authentication information so my authentication information is going to be whatever my mail server my SMTP mail server is so just make sure you know when when you're doing this you have all that information with you but this is really you know fairly standard for setting up any type of mail account whether it's Outlook or whatever but this just so happens to be in sequel server so I'm going to click OK here click Next and here I'm going to choose this as the default profile so when you're using some stored procedures later to send email and you don't specify a specific profile it's going to use this profile or you could specifically set this profile using one of the parameters within the extended store procedures for database mail so I'm just going to click Next because I already set it now these parameters in particular you'll notice there is a file size here so in some of the extended stored procedures for database mail you can send out queries and they can limit the size of the database attachment or the size of the message itself so here I set it to a megabyte which is enough because if you said it if you typically if you mail anything other than one megabyte it's pretty big for a mail server so that's enough for me and I'm going to just choose the defaults I'm going to click Next so the next thing I'm going to do is test the mail and I'm going to send a quick email here so I'm going to put in my email that I want to send the email to cowboy board at gmail.com and I'm going to send a test email and I'm going to click OK here now you'll notice in the background it already sent so that was pretty quick this is my gmail account from my PO cowboy so you'll notice if I open up the email that was the message that was sent but also if I go in and I check the queue under the system database ms DB if you query this view here you'll notice all the emails that you've sent is going to be in this queue so you could check this queue basically to see if it's sent or not this table right here so there's also other ways to this particular view here gives you a status of things that weren't sent so I did try to send other stuff that was not successful and I'll give you a reason why so and you could also delete from the view so if I if I delete these items for example you'll see now it's now it's gone so you'll have to clear that once in a while but I could also send an email by using this stored procedure here and I'll go in more depth later on how to do more monitoring queries and how to set up a job to actually monitor not not so much database issues but more application issues or more system processes issues that you want to aquarii for on a normal production environment so be doing a video next on that but in this case I'm just going to send a simple email and you'll notice if I check my queue again it's in the queue and it's actually already sent so let me check my email and you'll notice it's here so that's how you set up a database mail and that's the benefits of having database mail is actually having the monitoring jobs running and sending alerts to you and notifications to you so in a in the next video I'm going to go more in depth on how to do a query mail it as an attachment and create a basically a cron job or a sequel server agent job that actually monitors it and you know sends it every two hours for example okay thank you for watching
Info
Channel: CodeCowboyOrg
Views: 41,123
Rating: 4.7837839 out of 5
Keywords: SQL Server, Database Mail, DB mail, sp_send_dbmail, dbmail, MSSQL, 2008, SMTP, setup, configure, database, monitoring, notifications, Tutorial, Step, By, Beginners, Microsoft, How To, HowTo, How, Setup, Configure, Set Up, Quick Start, Learn, Dummies, End To End, End, Teach, Intro, Demo, Example, Configuration, Install, 2013, 2012, 2010, 2011, 2014, SQL Server 2008, SQL Server 2012, SQL Server 2008R2, SQL Server 2008 R2, Sample, Track, Changes, Incremental, 2005, 2000, Begin, Best, SQLServer, MS SQL, mail
Id: Y_thOyEoGkg
Channel Id: undefined
Length: 6min 55sec (415 seconds)
Published: Sun May 04 2014
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.