function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDC DummySFDC Dummy 

Migration issue

I have created a trigger on Task Object and test that trigger .the code coverage is 100%

but when i am deploying that trigger its thowing error like other test class code coverage iss failuer

error

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Trigger_Task_Send_Email: execution of AfterInsert caused by: System.EmailException: SendEmail failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Missing target address (target, to, cc, bcc): [] Trigger.Trigger_Task_Send_Email: line 73, column 1: []
Stack Trace: Class.testSendkycEmail.teSendkycEmail: line 11, column 1



how to solve this
Andreas MeyerAndreas Meyer
Hi,

the error message is pretty selfexplaining .. you missed to provide the to,cc or bcc info while you trying to send the email. It would be more helpful if you post the source code  .. without that it is just guessing. When it comes to sending email from a Unittest take a look at Jeff Douglas blog:

http://blog.jeffdouglas.com/2008/10/15/how-to-unit-test-sending-mail-in-apex/

Best,
Andreas