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
PRepakaPRepaka 

Getting problem with setReplyTo property for sending email

hi

 

when i setReplyTo property also i am unable to get the from address.

 

My code is like this:

 

Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); 
email.setTemplateId(objEmailTemplate.Id);
email.setReplyTo('padmavathi@appshark.com');

email.setSenderDisplayName('Appointment Confirmation');

email.setTargetObjectId(objContact.id);
email.setSaveAsActivity(false);
email.setWhatId(AppointmentId);
Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});

 

 

but still default login salesforce user email address is coming when i click on Reply.

 

please help me 

Best Answer chosen by Admin (Salesforce Developers) 
kevin hekevin he
I encountered the same thing. I have no idea what to do?But I kown it is because you use the email template.As you can setReplyTo in email template, so you will not be set replyTo in this process, that is what I found. Someone can give more information? thanks.

All Answers

kevin hekevin he
I encountered the same thing. I have no idea what to do?But I kown it is because you use the email template.As you can setReplyTo in email template, so you will not be set replyTo in this process, that is what I found. Someone can give more information? thanks.
This was selected as the best answer
vijaymindvijaymind

Hi I tried to use without template too , but its still not working , when I hit the reply it goes to admin email Id :

 

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setToAddresses(new String[] {'myemail@gmail.com'});
mail.setReplyTo('test@gmail.com');
mail.setSenderDisplayName('Batch Processing');
mail.setSubject('Batch Process Completed');
mail.setPlainTextBody('Batch Process has completed');
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

 

Any Idea ?