Intermittent EXECUTE permission was denied on the object 'sp_send_dbmail', database 'msdb' I have a job that runs every 2 minutes and sends an email to users after it has gathered job information. Most of the time it is successful but every couple of days it fails with the Execute permission was denied. Right after the failure it runs again just fine.

It is a job that goes through tables and gets information and status of certain jobs. Not SQL Server jobs but proprietary application jobs that has its information stored in tables in the databases. It fashions an email and sends it in HTML format from msdb.dbo.sp_send_dbmail.

It is owned by sa and is not run manually. I'm thinking that since it only happens once every couple of days (sometimes 3 or 4), it could be the content of the message is too big or has some garbage in it that prevents the msdb.dbo.sp_send_dbmail proc from sending.

There is no error handling on the job or step. There is only one step: It executes the proc that aggregates the information and sends the email. The agent log says the same thing that's in the title of the question about permissions.

SQL Server is setup to log failed logins. There have been no failed logins as of a week ago.
Resolved this by setting up a maintenance plan to clean up MSDB. It was very full! Waited to post the answer because I wanted to make sure we went through a few weeks without getting that Execute permission denied error.