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

SetReplyTo for visualforce email template



Can u please tell me how to set SetReplyTo option for an Visualforce email template. by default it takes the User email id. but i want to change the reply to email address. how can i do this. please help me


In the controller:



Declare the object:

public Messaging.SingleEmailMessage mailHandler = new Messaging.SingleEmailMessage();


Setting the replyto:





Hope it helps,



Message Edited by crm_expert on 10-16-2009 12:06 AM
Rasmus MenckeRasmus Mencke

Here is an example in a visualforce email template:



<messaging:emailTemplate subject="test" replyTo="" recipientType="contact" > <messaging:plainTextEmailBody > Congratulations! This is your new Visualforce Email Template. </messaging:plainTextEmailBody> <messaging:htmlEmailBody >fdsdf</messaging:htmlEmailBody> </messaging:emailTemplate>





Hi Rasmus,


This setting of replyTo attribute in emailTemplate tag isn't working for me, whatever be the email domain..i.e., or or


Is there any other setting we should be using to make it work? 

Did you find a solution to this? I'm having the same problem. Setting the replyTo attribute in the Visualforce email template doesn't seem to have any impact. Neither does using setReplyTo() via Apex.
Nope. I gave up after several attempts

Guys, Not sure if this helps you  but one way is as follows:


Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();



Which seemed to do the trick for me in my email class. However I haven't managed to generalize it using a string variable read from an object field:



String DONOTREPLY = Account.DoNotReplyEmail__c;
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();

Hope this helps. (Sorry if you get a bunch of emails I had trouble pasting the code lines in).