'profile name is not valid' error with sp_send_dbmail

  • I am currently migrating our sql2000 instance to sql2k5 on a new server. As part of this migration we are moving away from SQL mail and replacing it with Database Mail.

    I am getting close to getting this implemented but have what I think is a final hurdle to get over until I get this working.

    If I run the following under an account with the sysadmin server role it works:

    EXEC msdb.dbo.sp_send_dbmail

    @profile_name = 'Student Service Team',

    @recipients = 'jh@somewhere.com',

    @subject = 'Test',

    @body = 'Message',

    @body_format = 'HTML';

    If I run it against an account with more restricted permissions it fails with the following error message:

    Msg 14607, Level 16, State 1, Procedure sp_send_dbmail, Line 119

    profile name is not valid

    I have tried assigning the DatabaseMailUserRole and/or db_owner role on msdb. It seems that the only way I get this to work is to assign the sysadmin role which obviously is not sensible for a production environment.

    I think the error message is a red herring as I know the profile name is valid. Googling hasn't yielding any useful leads. Does anyone have an idea on why this is failing and how I can get it to work?

  • I managed to resolved this. Needed to make the profiles public by using:

    EXECUTE msdb.dbo.sysmail_add_principalprofile_sp

    @principal_name = 'public',

    @profile_name = 'Student Service Team',

    @is_default = 1 ;

    Did this for each of the profiles and it's all working now.

  • Try the solution mentioned in this Blog Post:

    https://cms4j.wordpress.com/2013/12/17/msg-14607-level-16-state-1-profile-name-is-not-valid/

  • This was removed by the editor as SPAM

  • This was removed by the editor as SPAM

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply