Solved

sql mail profile sql 2005

Posted on 2010-08-21
7
1,309 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
  • 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 30

Accepted Solution

by:
Brad Howe earned 500 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to shrink a transaction log file down to a reasonable size.

808 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