Profile name is not valid [SQLSTATE 42000] (Error 14607)

Question

Thursday, June 25, 2015 5:23 PM

I have a job that when it runs sends out an email in and HTML format with table records about on hand inventory.

the query works but when it come to emailing it fails with the above error.

I have check in Management and Database mail is enabled and a test email works perfectly

In SQL Server Agent the Test button is Greyed out

FailSafe Operator is enabled and sent via email checked.

I must be missing a step. Anyone have and suggestions?

All replies (4)

Thursday, June 25, 2015 7:46 PM ✅Answered | 2 votes

How do you send the email? Does your code use sp_send_dbmail? I think so (since it is HTML encoded), so go and check your code and make sure that you specify the profle name as one of the parameters. Aso verify that this profile actually exists and is a public profile.

Tibor Karaszi, SQL Server MVP | web | blog


Thursday, June 25, 2015 5:39 PM

Hello,

By the error message you are using the wrong database profile name to send the email

Olaf Helper

[ Blog] [ Xing] [ MVP]


Thursday, June 25, 2015 7:08 PM

I would agree but I only have one profile so I do not understand how that could be. Is there someplace

to specify the profile for a database? SQL 2012


Thursday, June 25, 2015 9:03 PM

That was it.

I copied the code from another server and edited it and forgot to set the profile to the new server's profile