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
OzOz 

Sending emails and S-Controls

The application that I am creating needs to send an email out upon completion of a process. The process happens in a S-Control that updates a Custom Object.

Is there a way of sending emails through an S-Control? I have been hearing of an emailauthor.jsp but have not been able to find info on it.

Thanks.

-Oz
DevAngelDevAngel
Hi Oz,

I really depends on what you scontrol is made of! If you are using an embedded jsp/asp, activex or applet, then you should be able to do email without much trouble. If you are using the AJAX toolkit (javascript) then you will have some difficulty. You can as you mention use the emailauther.jsp, but this is unsupported and subject to change without notice.

/email/author/emailauthor.jsp?retURL=%2F003D000000Bxtvg&rtype=003&p2_lkid=003D000000Bxtvg&p6=Some+subject&p7=This+is+the+body+of+the+email

The url above, when used from an scontrol by setting window.parent.document.location.href, will cause the email screen to be shown with the subject - p6 and the body - p7 filled in. The p2_lkid is the id of the contact, in this case, to send the email to, the rtype is the prefix for a contact (enables the search link I think) and retUrl is the url back to the contact detail page.

Not sure how you would do attachments.
Mike ShawalukMike Shawaluk


DevAngel wrote:
Hi Oz,

I really depends on what you scontrol is made of! If you are using an embedded jsp/asp, activex or applet, then you should be able to do email without much trouble. If you are using the AJAX toolkit (javascript) then you will have some difficulty. You can as you mention use the emailauther.jsp, but this is unsupported and subject to change without notice.

/email/author/emailauthor.jsp?retURL=%2F003D000000Bxtvg&rtype=003&p2_lkid=003D000000Bxtvg&p6=Some+subject&p7=This+is+the+body+of+the+email

The url above, when used from an scontrol by setting window.parent.document.location.href, will cause the email screen to be shown with the subject - p6 and the body - p7 filled in. The p2_lkid is the id of the contact, in this case, to send the email to, the rtype is the prefix for a contact (enables the search link I think) and retUrl is the url back to the contact detail page.

Not sure how you would do attachments.


Oz and DevAngel,

I just spent some time "reverse engineering" the whole emailauthor.jsp thing, for a similar purpose. Building on what DevAngel has already provided, I was able to invoke a previously stored email template, which fills in the subject, body and attachment(s). My URL looks something like this:

window.parent.location = "/email/author/emailauthor.jsp?retURL=%2F{!Key_ID}&p3_lkid={!Key_ID}&p2_lkid={!Key_Contact_ID}&new_template=1&nosave=0&template_id=" + templateArray[templateIndex];

{!Key_ID} is the record ID of a custom object; {!Key_Contact_ID} is a related contact ID; and templateArray[] is an array of template record IDs (my code can pass different template IDs depending on other conditions in the code).

I do understand that use of emailauthor.jsp is currently unsupported and subject to change, but I couldn't find any other way to do this. It's my understanding that even with workflow rules on custom objects (which we're supposed to be getting within the next couple weeks) we can only send emails to SFDC users, not to account contacts.

Thanks,

- Mike
OzOz
What I ended up doing was rederecting to a web server and using an asp script to do the workload of sending emails and any other memory intensive tasks. Works pretty well now.
QasQas
Guys,
 
I am new here and trying to achieve something similar. Is there any update on emailauthor? Are we still able to use it? Is there a better way to do this?
hatnethatnet

Mike,

I am trying to send a workflow alert to a contact instead of a user.  Is that possible with an s-control?

Josh

Chirag MehtaChirag Mehta
From above conversation i was able to create a email and even send the same
 
But if i use Email Template (which internally uses Merge Fields) in the emailauthor.jsp URL
then those merge fields dont get populated in mail body ..only the empty email template is mailed
 
 
 
 
vadevvadev
Is it possible to use emailauthor.jsp to send an email to an opportunity owner?

I've been scouring the net for the answer to that question and I can't find anything.

-=Bryan
Chirag MehtaChirag Mehta
You can read more on Emailing thru Scontrols @ http://community.salesforce.com/sforce/board/message?board.id=ajax_toolkit&message.id=1180#M1180

Also by default the owner comes as bcc when u try emailing using emailauthor.jsp