sp_send_dbmail on SQL Server Agent

I test email functionality on SQL Server 2012 Developer edition.

The sp_send_dbmail works fine when manually executed by running EXEC dbo.SendEmailTo. But this stored procedure returns error code 102 when scheduled on SQL Server Agent.
I could not find the code on documentation. Where from I can get the details of the error code ?