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
Abhijeet Purohit01Abhijeet Purohit01 

Problem in email template - apex code

I have created an Email Template and tosend an email using this template:

The from section of the email is: admin@gmail.com.

 

I want to change the from email id address.

How can I change the From Email Id?

 

I even changed the Author of the Email Template but still no change.

 

Can anyone help me? Pls.

vishal@forcevishal@force

How is this related to Apex?

 

I think you'll need to change your email settings for this.

 

Go to Personal Setup -> Email -> My Email Settings.

 

 

Abhijeet Purohit01Abhijeet Purohit01

I have written a code to send single email. For this I have used the following

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

 

to send single email I have created an Email Template. In this email template I have used 

<messaging:HtmlEmailBody>

<c:VisualForceComponent></c:VisualForceComponent>

</messaging:HtmlEmailBody>

 

The email is getting sent. The problem is the email is being sent from ADMIN@gmail.com. I want to change this to abc@gmail.com

 

How can I do this?