Last active
October 5, 2017 15:13
-
-
Save TonyRenHK/67721ffcf9d7ed806d3fb521e3c62a15 to your computer and use it in GitHub Desktop.
How to log issue in SFDC by sending email?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ID userid = UserInfo.getUserId(); | |
User currentUser = [SELECT Id, Email FROM User WHERE Id =:userid]; | |
List <String> ToAddresses = new List <String>(); | |
ToAddresses.add('[email protected]'); | |
String subject = 'Issue Log Notification Email'; | |
String body = 'Test' + '\n'; | |
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); | |
email.setTargetObjectId(currentUser.id ); | |
email.setToAddresses( ToAddresses ); | |
email.setSaveAsActivity(false); | |
email.setBccSender(false); | |
email.setUseSignature(false); | |
email.setSubject( subject ); | |
email.setHtmlBody(body);//email.setPlainTextBody( body ); | |
Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment