?
Solved

sql mail profile sql 2005

Posted on 2010-08-21
7
Medium Priority
?
1,345 Views
Last Modified: 2012-05-10
i have a mail profile created when i am trying to send a test message this is the error i am getting in mail log

Exception Type: Microsoft.SqlServer.Management.SqllMail.Server.Common.BaseException Message:Could not retrieve item from the queue. reason. the list of accounts which could send this mail is empty (probably dude to use of invalid profile).

can some one help me to fix this,
0
Comment
Question by:romeiovasu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 2

Expert Comment

by:ymiossec
ID: 33491929
how did you define the profile you use to send that email ?
Give more details...
0
 

Author Comment

by:romeiovasu
ID: 33491935
i have created the profile in sql server itself.
0
 
LVL 30

Expert Comment

by:Brad Howe
ID: 33491962

DId you restart the SQL Agent after configuring the mail profile for it.

There are two mail systems, SQL Mail, run by the SQL Server database engine used to send applicaiton emails etc , and SQL Agent Mail, run by SQL Agent which uses Database Mail set up with a profile for the SQL Agent to send alerts/ notifications.

Do you have Database Mail and SQL Mail both defined to use the profile?

- Hades666
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 30

Accepted Solution

by:
Brad Howe earned 2000 total points
ID: 33491970

Here is a good example on sqltips - http://www.mssqltips.com/tip.asp?tip=1100 

And here is a scripted approach.
-- Create a Database Mail profile
EXECUTE msdb.dbo.sysmail_add_profile_sp
@profile_name = 'SQL2005_Email_ProfileName',
@description = 'Notification service for SQL Server' ;

-- Create a Database Mail account
EXECUTE msdb.dbo.sysmail_add_account_sp
@account_name = 'SQL Server Notification Service',
@description = 'SQL Server Notification Service',
@email_address = 'john.doe@domain_name.com',
@replyto_address = 'john.doe@domain_name.com',
@display_name = 'SQL Server Notification Service',
@mailserver_name = 'smtpserver.domain_name.com' ;

-- Add the account to the profile
EXECUTE msdb.dbo.sysmail_add_profileaccount_sp
@profile_name = 'SQL2005_Email_ProfileName',
@account_name = 'SQL Server Notification Service',
@sequence_number =1 ;

-- Grant access to the profile to the DBMailUsers role
EXECUTE msdb.dbo.sysmail_add_principalprofile_sp
@profile_name = 'SQL2005_Email_ProfileName',
@principal_id = 0,
@is_default = 1 ;

SELECT * FROM msdb.dbo.sysmail_profile
SELECT * FROM msdb.dbo.sysmail_account

to test:
sp_send_dbmail [ [ @profile_name = ] 'profile_name' ]
[ , [ @recipients = ] 'recipients [ ; ...n ]' ]
[ , [ @copy_recipients = ] 'copy_recipient [ ; ...n ]' ]
[ , [ @blind_copy_recipients = ] 'blind_copy_recipient [ ; ...n ]' ]
[ , [ @subject = ] 'subject' ]
[ , [ @body = ] 'body' ]
[ , [ @body_format = ] 'body_format' ]
[ , [ @importance = ] 'importance' ]
[ , [ @sensitivity = ] 'sensitivity' ]
[ , [ @file_attachments = ] 'attachment [ ; ...n ]' ]
[ , [ @query = ] 'query' ]
[ , [ @execute_query_database = ] 'execute_query_database' ]
[ , [ @attach_query_result_as_file = ] attach_query_result_as_file ]
[ , [ @query_attachment_filename = ] query_attachment_filename ]
[ , [ @query_result_header = ] query_result_header ]
[ , [ @query_result_width = ] query_result_width ]
[ , [ @query_result_separator = ] 'query_result_separator' ]
[ , [ @exclude_query_output = ] exclude_query_output ]
[ , [ @append_query_error = ] append_query_error ]
[ , [ @query_no_truncate = ] query_no_truncate ]
[ , [ @query_result_no_padding = ] query_result_no_padding ]
[ , [ @mailitem_id = ] mailitem_id ] [ OUTPUT ]
 
Cheers,
Hades666
0
 

Author Comment

by:romeiovasu
ID: 33492070
how to configure gmail server as an smtp mail component for sql server.
0
 
LVL 30

Expert Comment

by:Brad Howe
ID: 33492171
Hi,

START \ add remove windows components and install IIS with SMTP Services.
I don't know what verion OS you have.

2003
http://msdn.microsoft.com/en-us/library/8b83ac7t.aspx 

2008
Windows 2008 Server Manager Features right-click Add Feature SMTP Server

To manage the SMTP service on Windows Server 2008, you must use Internet Information Services (IIS) 6.0 Manager. Ensure that you install IIS 6.0 Management tools in Server Manager.

Cheers,
- Hades666
0
 
LVL 30

Expert Comment

by:Brad Howe
ID: 33492175
Sorry for GMAIL, yuo can only authenticate as one person.
See this link on how to configure it. - http://www.codingbliss.com/cb/?p=38
Cheers,
Hades666
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question