Email Button

I am trying to code a button to send to a email address in the open contact by opening the users default mail client on click and creating a new email to match a Salesforce email template.

I would also like to do the same type of thing for selected contact in list view.

It is perhaps easier using a row action to direct using URL and as you can see in this screenshot…

As a URL we used this…

[https://na11.salesforce.com/_ui/core/email/author/EmailAuthor?p2_lkid={{Contact__c}}&rtype=003&a…](https://na11.salesforce.com/_ui/core/email/author/EmailAuthor?p2_lkid={{Contact c}}&rtype=003&retURL=%{{Contact c}} “Link https//na11salesforcecom/_ui/core/email/author/EmailAuthorp2_lkidContact__crtype003retURLContact__c”)

Which will ultimately use the email function on salesforce by taking the end user straight to the page and then dumping the contact (Via contact ID) into the recipient field.

I know it’s not exactly what your looking for but in many ways this is a better option as it ensures that all the transactions remain contained on the Salesforce instance and you are not requiring to use an email client.

Good luck and let me know how you go?

Thanks.  We have to use the native email client (Outlook).  Any ideas?

Could possibly write a .php snippet. I will keep looking into it =)

Allison,

Try using ‘mailto’ in your button.  The sample below is the redirect URL of a button that belongs to a Page Title whose model is a Contact object.

mailto:?subject=Contact Information for {{Name}}, {{Professional_Suffix__c}}&body=%0D%0A%0D%0AName: {{Name}}%0D%0APhone: {{Phone}}%0D%0AMobile: {{MobilePhone}}%0D%0AFax: {{Fax}}%0D%0AEmail: {{Email}}%0D%0AAddress: {{MailingStreet}}, {{MailingCity}}, {{MailingStateCode}} {{Mailing_Zip_Code_Lookup__r.Name}}

Thanks,

Bill

That worked.  Do you know how I could (1) insert contact's email in the To field, and (2) insert HTML into the body of the email?

Have you looked into using Cirrus Insight or SalesforceIQ Inbox?

Additionally, seems like HMTL insert is impossible.

http://stackoverflow.com/questions/5620324/mailto-with-html-body

You can do some basic things like a adding a line break though.

http://stackoverflow.com/questions/11507387/mailto-body-formatting

I did a quick POC on this a while back.  Here is the snippet I ran from my page, triggered by a button.  It produced an email open (using Outlook, native email client) and populated the Subject, To and Body.  You can also BCC or CC folks by just adding those to the url string.


var params = arguments[0], $ = skuid.$;

AcctModel = skuid.model.getModel(‘account’),
AcctRow = AcctModel.getFirstRow();
AccountId = AcctModel.getFieldValue(AcctRow,‘Id’,true);

ContactModel = skuid.model.getModel(‘contact’),
ContactRow = ContactModel.getFirstRow();
contactEmail = ContactModel.getFieldValue(ContactRow,‘Email’,true);

var subject = “This is my subject”;
var email = contactEmail;
var emailBody = “Hello World ref:”+AccountId;

var url=“mailto:”+email+"?subject="+subject+"&body="+emailBody;

window.top.location.href= url;