Visit Rasmus Mencke's personal blog on Developer Force

Default Task Type to Email when sending an email

One question I hear over and over again, is why is the task type when I am sending an email in Salesforce not defaulted to Email? This is becomes an issue when you want to do reporting on all your tasks and they are logged as your default task type which generally is "Call".

I have written an Apex Trigger you can use to overwrite the Task Type and set it to "Email" when you are sending out an email from Salesforce. The trigger will look for "Email:" in the subject and also look for "Additional to:" as the first… Continue reading

In Blog: engineering | Tagged | 2 Comments

Tech Talk: Want to Learn About Building Email Services?

Join the webinar Tech Talk Series: Email Services on Force.com on Wednesday July 1st.

Will give you a great introduction into how you can leverage Email Services and start building email integration into Salesforce. You will learn and see examples of how to build your own services.

We will show you

  • What are Email Services
  • How to build an Email Service
  • Security model for Email Services

See you on July 1st!

Rasmus MenckeSenior Product Manager

 … Continue reading

In Blog: engineering | Tagged | 2 Comments

How do I Access Ideas Merge Fields in an Email Template?

A lot of people have been asking for access to Idea’s merge fields in email templates. With Visualforce Email Templates released in Winter ’09 you can now access Ideas merge fields from within the email templates.

Here is a sample template which shows you how to create this template, and starting use Ideas merge fields with your email templates, to see the sample email template click here

One disclaimer, this is only available with the new Visualforce Email Templates, Ideas merge fields are not currently exposed in regular templates.… Continue reading

In Blog: engineering | Tagged | Leave a comment

Visualforce email templates sample

Visualforce Email Templates Sample

In
the Winter ’09 release you can now take advantage of the new
Visualforce Email Templates, which leverages the innovative Visualforce
technology to also provide the underlying framework for email
templates.

To see an example and learn how you can build Visualforce email templates visit the Developer Network and see the sample click here… Continue reading

In Blog: engineering | Tagged , | 7 Comments

Apex Email Services message restrictions

What are the different size limitations for Apex Email Services?

There are some limits on what data and data sizes can be used
for Email Services. This post will explain how some of these limits
work.

  • The max email message size for a complete email message including attachments is 10MB
  • Emails which are below 10MB will be accepted by our mail server
  • Email which are above 10MB will be rejected and an email response sent back to the sender

There are two separate parts of an email body

  • Text Body of the email can max be 100KB
  • HTML body of the email can max
In Blog: engineering | Tagged | Leave a comment

Test method for Email Services with Attachments

If you are new to Force.com Email Services and having a hard time writing test methods for your Apex code, this code sample might help you get started.

You can receive email attachments with inbound emails and often you want to build Apex code that uses the attachments. How do I create an inline attachments for the test method?

The example below shows you how you can create a new email message and assign the attachments to it. You can also find the code sample here.

static testMethod void myTestMethod() {   // Create a new email, envelope object and Attachment   Messaging.InboundEmail… Continue reading

In Blog: engineering | Tagged | Leave a comment

Create Ideas from Emails

I have built an example of how you can use Salesforce Ideas and create new ideas from emails. Using Force.com Email Services to allow people to send emails and convert the emails into new Ideas.

Taking the subject line as the title of the Idea and use the body of the email as the content for the Idea.

The main class for creating the Email Services is below.

Global class IdeasSample implements Messaging.inboundEmailHandler{ Global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email,  Messaging.InboundEnvelope env ) { Messaging.InboundEmailResult result = new Messaging.InboundEmailResult(); // Create the new Idea from the incoming email        createIdea(email.subject, email.plainTextBody, env.fromAddress);    //… Continue reading

In Blog: engineering | Tagged | 3 Comments

Force.com Email Services sample code for how to unsubscribe from emails

Most companies send out marketing emails to their customers and
prospects, and need a way to allow them to unsubscribe from your email
messages. This sample code shows how you can write Force.com Email
Services to process unsubscribe requests from the email recipients.

  • The code will search in the subject line for the word “unsubscribe”
  • If the words is found, I will first find all contacts who
    matches the from Email Address and set the HasOptedOutOfEmail to true
  • Then I search though the Leads and look for the same email address and updates the HasOptedOutOfEmail to true as well
  • The code then returns
In Blog: engineering | Tagged | 1 Comment

Force.com Email Services

Force.com Email Services or email to Apex is now generally available
for all customers who have Apex Code enabled. Email Services lets you
define email addresses, which can process Apex code. Send emails to
Salesforce and process them with Apex code to create and update data
from inbound emails.

The sample code shows you how an email can be
used to create new tasks for a contact record with a matching email
address.

Example:
Send an email to Saleforce with a follow-up note, will setup a task with a reminder 1 day for now.

What is new in the Spring’08 release

  • Must implement the Messaging interface
  • Implemented a
In Blog: engineering | Tagged | Leave a comment

Send Emails Via APEX API in Eclipse

Many customers and partners have a need to send emails when building integrations with salesforce.com.  With the APEX API’s you can now leverage the platform to send emails.

You can send individual emails to email addresses, contacts, leads or users, and additionally you can CC or BCC email addresses to the email you are sending.

Mass Emails can be sent to contacts, users or leads, using templates. The API provides an option to save the email as an activity on the contact or lead you are sending the email to.

To see a code example and learn more about send emails through the… Continue reading

In Blog: engineering | Tagged | 1 Comment