Problem
You are trying to send an email using “msdb..sp_send_dbmail” but you keep getting one of the following errors:
Msg 14636, Level 16, State 1, Procedure sp_send_dbmail, Line 107 [Batch Start Line 2]
No global profile is configured. Specify a profile name in the @profile_name parameter.
Msg 14607, Level 16, State 1, Procedure sysmail_verify_profile_sp, Line 42 [Batch Start Line 2]
profile name is not valid
The next question in your mind is “Okay, then what profile do I need to provide?”
Surprisingly when I googled for this I could not find a straight answer, lots of round about answers, but nothing to the point.
Solution
Here is my straight to the point answer:
- Go to the server that is having the problem because this is sever specific
- Execute the following sproc: EXEC msdb.dbo.sysmail_help_profile_sp;
- Hopefully you are given a row
- Yes I got a row – okay great use that profile name
- No I got no rows – then you need to create a new profile, there are instructions on how to do this everywhere
Lastly here is an example (no article is complete without one, especially when you can’t seem to find a clear one):
exec msdb..sp_send_dbmail @recipients='[email protected]' ,@importance='high' ,@subject='This is a test' ,@body='Hi mom!' ,@profile_name='[Your profile name goes here]' -- EXEC msdb.dbo.sysmail_help_profile_sp;