You need to sign in to do that
Don't have an account?
Lukesh Karmore
hii can we use CSS in setHtmlBody in Messaging.singleEmailMessage
hii can we use CSS in setHtmlBody in Messaging.singleEmailMessage
I am tryingh it but when send mail Css is not working
thank you
I am tryingh it but when send mail Css is not working
thank you
Hi Lukesh,
Yes,You can apply the css in setHTMLBody.
Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
message.settoAddresses(new String[] {'xyz@gmail.com'});
message.setsubject('Test');
message.setHtmlBody('<h1 style="color:red;">Hello</h1>');
Messaging.SingleEmailMessage[] messages = new List<Messaging.SingleEmailMessage> {message};
Messaging.SendEmailResult[] results = Messaging.sendEmail(messages);
I hope you find the above solution helpful. If it does, please mark it as the Best Answer to help others too.
Thanks and Regards,
Suraj Tripathi