Sunday, February 19, 2012

Database Mail

I am trying to configure Database Mail on a new installation of SQL Server 2005 and the 'DatabaseMailUserRole' does not exist.

How do I add this role to the server?
Hi,

mhmm, strange thing, but use this script to recreate the Role:

IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'DatabaseMailUserRole' AND type = 'R')

CREATE ROLE [DatabaseMailUserRole] AUTHORIZATION [dbo]

HTH, Jens Suessmeyer

http://www.sqlserver2005.de

|||Jens,

Thanks for the reply.

I was able to add the role using your script and added a user with the following script -

sp_addrolemember @.rolename = 'DatabaseMailUserRole',
@.membername = '<user name>'

However, it only added the role to the default database. Is there a way to make this a server role that shows up for each database?

Thanks for your help. I'm sure glad there are smart people in the world.
|||Hi,

you only need the role in the msdb database in order to send mails.

HTH, Jens Suessmeyer.

http://wwww.sqlserver2005.de
|||

Jens,

Thanks very much. I think everything is setup now.

Regards,

Dan Holsonback

|||I am having similar problems - I just added the (missing) DatabaseMailUserRole using the example provided. Now I am trying to execute the code in the 'troubleshooting' box

sp_addrolemember @.rolename = "DatabaseMailUserRole',
@.membername = "administrator" (i'm trying to use the administrator email account).

Now I get the error "User or role 'administrator@.avnnb.ca' does not exist in this database." Just what exactly am I supposed to use as membername? I can't find a tiny bit of documentation to help me in this regard.

|||Sorry. no real problem. there was an antivirus program running on mail server, which was stopping the email from getting through.

No comments:

Post a Comment