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
HarryKHarryK 

Help with mass email and templates


I am relatively new to s-controls.  I need to send an email to a number of records of a custom object using one of several templates (that contain merge fields from the custom object). The template will be determined by certain fields returned (via query or retrieve) on each record along with the email address. Can someone please point me to documents or better yet examples how that is accomplished?

Thanks in advance,
Harry
ApprivoApprivo
Henry

Mass email cannot be used for custom objects, so your choices are to send email from each record individually or programmatically identify the records you want to send the email to and send the email via an scontrol.

 

I will leave it to you to write the code to identify the records and template(s) you want to use. If you are not sure on how to do this, there are lots of examples on the boards on writing scontrols.

 

Once you have the information you need I think you will find the following scontrol helpful. It shows how to construct a send email URL with that information. Your code coud iterate through each record that you have identified and fire this scontrol for each record.

 

Here is an example of a scontrol to send an email. This one happens to be doing it from a rebate custom object so you will have to replace those references with your merge fields

 

<script language="javascript">

var url="/email/author/emailauthor.jsp?retURL=/{!SFDC_Rebate_ID}&template_id=00X60000000vIs0&new_template=1&p2_lkid=00Q300000095NW7&p3_lkid={!SFDC_Rebate_ID}&p24=email1@domain.com; email2@domain.com;email3@domain.com;email4@domain.com;email5@domain.com&p4=ccemail@domain.com&p5=bccemail@domain.com&save=1";

parent.location.href=url;

</script>

 

Notes:

Template ID: Replace with your template ID

new_template: Set to 1 if you want to include the attachment that your template may have, otherwise set to zero or exclude this parm

p2_lkid: This takes a contact id and resolves it to the first “to” entry

p3_lkid: sets the ‘related’ to drop down box and value correctly

p24: sets the ‘additional to’ field. Here is where you can aggregate all the email fields from your record

p4: the cc email

p5: the bcc email

save: set to any value and the email is sent automatically. Exclude the parm to review the page and then press send

 

Andrew.

HarryKHarryK
Thanks Andrew. I got it to work.

Can someone please refer me to a document the describes all the parameters that can be passed to emailauthor.jsp?

Thanks again,

Harry

DevAngelDevAngel
There is no document as this is not a supported operation.
federico_vela_pfederico_vela_p
Dave,

It is not supported, but it wont be removed anytime soon right? :)

thanks
DevAngelDevAngel
We reserve the right to change how that works at anytime.

Sorry
federico_vela_pfederico_vela_p
Would there be any kind of notification or anything like that to let us know it will change?
Is it possible to take a look at the sourcecode for that jsp ???

I am now, thinking of developing my own emailer jsp page to host in a remote server.

If i take this route i have a question:

1) is there any way to retrieve an email template?
2) do i really have to fill in the template by hand 8-|

Thanks

Message Edited by federico_vela_p on 08-17-2006 02:13 PM

ChadMeyerChadMeyer

There might be some confidence that emailauthor.jsp won't be removed because salesforce published something in appexchange that uses it.  In the absence of documentation on emailauthor.jsp, does anyone know how I can define a specific FROM address for the email being sent?

I am using this for case comments, and the notifications to Contacts that are sent when a case is updated.  I want to make sure that if a customer replies to one of these emails, that it passes through my Email-to-Case system rather than going directly to my support rep's email box.

Thanks in advance!

 

ChadMeyerChadMeyer
I figured this out.  I pulled up the Send Email screen that is available when you enable Email to Case and viewed source.  That particular form allow you to define a From address, so I found that the "p26" argument is for the From address.  It works.
Chirag MehtaChirag Mehta

I am able to send Email using following things  ..but if i use the merge fields in email template and use that email template

while sending mails then those merge field doesnt  gets Populated in EMail Body

Without using Email Template :-

var sample_SFDC_ID = "{!Sample_ID}";

var managerEmailId="003T0000005fmrv";

var requestorEmailID="xyz@gmail.com";

var url="/email/author/emailauthor.jsp?retURL=/"+sample_SFDC_ID+"&"+

"p2_lkid="+managerEmailId+"&"+          // This takes a contact id and resolves it to the first “to” entry

"p24="+requestorEmailID+"&" +           // sets the ‘additional to’ field. Here is where you can aggregate all the email fields from your record

"p6=Some+subject&"+                   

"p7=This is the body of the email {!Sample_ID}";

window.parent.document.location.href=url;

Using Email Template :-

var sample_SFDC_ID = "{!Sample_ID}";

var emailTemplate = "00XT0000000qwas";

var managerEmailId="003T0000005fmrv";

var requestorEmailID=xyz@gmail.com;

 var url="/email/author/emailauthor.jsp?retURL=/"+sample_SFDC_ID+"&"+

"template_id="+emailTemplate+"&"+      //Replace with your template ID

"p2_lkid="+managerEmailId+"&"+          // This takes a contact id and resolves it to the first “to” entry

"p24="+requestorEmailID+"&" +           // sets the ‘additional to’ field. Here is where you can aggregate all the email fields from your record

"p6=Some+subject&"+                   

"p7=This is the body of the email {!Sample_ID}";

Addtional Fields you have

new_template: Set to 1 if you want to include the attachment that your template may have, otherwise set to zero or exclude this parm

 

save :set to any value and the email is sent automatically. Exclude the parm to review the page and then press send

 

p3_lkid: sets the ‘related’ to drop down box and value correctly

 

p4: the cc email

 

p5: the bcc email

 

But i want to use a email template while sending email with the email template having the merge fields of the Entity /Object on which the link for sending Email will be.

JohnyStyles577JohnyStyles577
You cannot to this from Team Edition.  This is one of the flagship features of Pro edition, along with Leads, Contracts, and Lead Conversion.

However, I have created an ingenius way of doing this that is fully integrated, and in my opinion better than their built in Mass Emailer because it allows you to Mass Email any type of Entity, whether it's built in (like Contacts or Accounts), or a Custom Object created by you.  Salesforce's built in solution ONLY works for SOME built in Entitys.

Additionally, you can use my solution directly from any View screen (tab), as opposed to going through a wizard (as required by the Salesforce Pro Edition Mass Emailer).

I am willing to sell this.  Email me if you're interested.

John Pequeno
johnystyles@gmail.com