Thanks for the replies! I have the solution, mail was not configured completely. Run this script:sp_configure 'show advanced options', 1;GORECONFIGURE;GOsp_configure 'Database Mail XPs', 1;GORECONFIGUREGO

Problem solved! I just do not understand why the test message is sending correctly when these options are not set...