Setup Database Mail in SQL Server 2008

Your applications can use SQL Server 2005 and higher to send emails using its Database Mail feature. This article describes how to configure Database Mail in SQL Server 2008.

Configure Database Mail

SQL Server Management Studio1. Launch the SQL Server Management Studio.
SQL Server Management Studio2. Expand the Management folder, right click Database Mail and click Configure Database Mail.
Database Mail Wizard3. In the Database Mail Configuration Wizard window, click Next.
Database Mail Wizard4. In the Select Configuration Task page, click Next. When asked to enable the Database Mail feature click Yes.
Database Mail Wizard5. In the New Profile page, fill in the Profile name and click Add.
New Database Mail Account6. In the New Database Mail Account window, fill in your mail server details and click OK.
Database Mail Wizard7. In the New Profile page, click Next.
Database Mail Wizard8. In the Manage Profile Security page, click Next.
Database Mail Wizard9. In the Configure System Parameters page, click Next.
Database Mail Wizard10. In the Complete the Wizard page, click Finish.
Database Mail Wizard11. In the Configuring page, click Close.

Testing Database Mail

SQL Server Management Studio1. In the SQL Server Management Studio, expand the Management folder, right click Database Mail and click Send Test E-Mail.
SQL Server Management Studio2. In the Send Test E-Mail window, fill in the To field with your email address and click Send Test E-Mail.
Windows Mail3. Check your email, you should see a new mail from Database Mail.
SQL Server Management Studio4. If you have not received any mail, check the Database Mail Log. Launch the SQL Server Management Studio, expand the Management folder, right click Database Mail and click View Database Mail Log.

Using Database Mail

SQL Server Management Studio
Type the command below in a query window.
EXEC msdb.dbo.sp_send_dbmail
  @profile_name = 'Alert',
  @recipients = 'johndoe@acme.local',
  @subject = 'Test Mail',
  @body = 'This is a test message'
NoteThe sp_send_dbmail stored procedure has a lot more parameter but those used above should be enough to get you started.

Write a Comment

Take a moment to comment and tell us what you think. Some basic HTML is allowed for formatting.

Reader Comments

in unable to fing database mail node in my sql server

It doesn’t take a genous to appreciate the dynamically-configured memory associated with SQL.