You need to sign in to do that
Don't have an account?
sankum
how to send email from triggers
hi
i need to send the email from trigger!
my requirement is
when a recored is updated in lead object the email is send to the owner or admin... BY using trigger only
how it is?
thanks in advance
KIRAN
Hi,
Try this
trigger EmailSendingToOwner on Lead (after update) {
EmailTemplate emailTemp = [select id,name from EmailTemplate].get(0);
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
email.setTargetObjectId(Trigger.new[0].OwnerId);
email.setTemplateId(emailTemp.id);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email });
}
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks
hi,
I would suggest to avoid sending emails using outbound email codes in trigger as this may hit your governer limits,
I think you have a limit on emails you can send, go through This documentaion to know more about about govener limits wrt emails...
thanks,