You need to sign in to do that
Don't have an account?
Mark Lewis 21
Using a noreply.***** email address when autoresponse trigger is activated
I have an autoresponse email trigger with this code
However, in my inbox it actually shows the user im using's email adress. Can I make this hidden or one of those "noreply@....com" emails where It just rejects replies to that given email?
trigger EmailToLeadResponseTrigger on Lead (after insert) { //Query on template object EmailTemplate emailTemplate = [SELECT id FROM EmailTemplate WHERE name = :'Sales: Lead Created']; //List of emails List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>(); for (Lead lead : [SELECT Id, Lead.Email FROM Lead WHERE Id IN : Trigger.new]) { if (lead.Email != null) { //Initialize messaging method Messaging.SingleEmailMessage singleMail = new Messaging.SingleEmailMessage(); //Set object Id singleMail.setTargetObjectId(lead.Id); //Set template Id singleMail.setTemplateId(emailTemplate.Id); //Flag to false to stop inserting activity history singleMail.setSaveAsActivity(false); //Add mail emails.add(singleMail); } } //Send mail Messaging.sendEmail(emails); }
However, in my inbox it actually shows the user im using's email adress. Can I make this hidden or one of those "noreply@....com" emails where It just rejects replies to that given email?
singleMail.setReplyTo('donotreply@do-not-reply.com');
singleMail.setSenderDisplayName('Automated Message - Do not Reply');
All Answers
singleMail.setReplyTo('donotreply@do-not-reply.com');
singleMail.setSenderDisplayName('Automated Message - Do not Reply');