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
Jasmine Cam 25Jasmine Cam 25 

Custom Send Email Button

I want to create a custom send email button on cases which will have a default 'From' email address and a default template. Is there a code for this that has worked for others that i can simply switch out the template ID and 'from' address?
Kadhar Basha JKadhar Basha J
Try this code:
Step 1: Create a custom detail page button like below

Setup------>button-------->case button and Links------->New Button

User-added image
location.replace('/email/author/emailauthor.jsp?retURL=/{!Case.Id}&p3_lkid={!Case.Id}&p2_lkid={!Case.ContactId}&template_id=00X2v000002b6mo&p26=abc@gmail.com&p24=xxxx@gmail.com&p5=yyyy@gmail.com&p4=sss@gmail.com');
&p24 = Additional Email Address
&p5 = BCC
&p4 = cc
&p2_lkid = Contact Id
&p3_lkid = Case Id (Related To)
&p26 = Default From Address
&template_id = default template Id

Step 2: Create a Default From address

Setup------>Organization-Wide Email Addresses ----> Add
User-added image

Step 3: Copy the default template Id from your org for case object
Setup---->classic Email template 

User-added image

Step 4: finally place the custom button in case page layout
Step 5: If you click the button then the new tab open for email sending option
User-added image​​​​​​​

Please mark it as best answer, if it is helpful for you

Thanks,
Kadhar Basha
Jasmine Cam 25Jasmine Cam 25
Hi Kadhar, 
This is great but we're currently having problems when sending emails with email addresses appearing twice. So when customers receive an email, the from address is "Full Name" <name@email.com> <name@email.com>.

Apparently this is blocked from a lot of organisations firewall. I'm not sure if it's anything to do with the email that we're using is a routing address. As when i used my personal email, this doesn't happen. Wonder if you would know?
Kadhar Basha JKadhar Basha J
Have you received the email 
 
Jasmine Cam 25Jasmine Cam 25
The button worked but when i receive emails through the button, the from email address appears as: "Full Name" <name@email.com> <name@email.com>. As it appears with double email address, apparently this is blocked from other organisations that have a firewall. Is there another way to put a default email?
Kadhar Basha JKadhar Basha J
Kindly provide a screenshot of your org-wide address edit page, because it is working for me 
Jasmine Cam 25Jasmine Cam 25
The email that i use isn't actually in Org-wide email addresses. The email is in email-to-case settings in the routing addresses. User-added image