- Home
- Technical Library
- Boards
- Cookbook
- Code Share
- Blogs
- Partners
-
More
-
Services
- Training & Certification
- Support
-
Galleries
- Force.com Sites Gallery
- Chatter Challenge Entries
-
Other Web Sites
- Salesforce.com
- Database.com
- AppExchange
- CRM Community
-
Add Recipe
App Distribution (13)
Bundle logic, interface and services for distribution.
App Logic (52)
The Apex programming language, workflow and formulas for logic.
Collaboration (7)
The Salesforce Chatter collaboration platform.
Database (29)
Data persistence, reporting and analytics.
Integration (57)
Web Service APIs and toolkits for integration.
Security (22)
Platform, application and data security.
Tools (17)
Force.com tooling
User Interface (38)
Visualforce MVC and metadata-drive user interfaces.
Web Sites (13)
Public web sites and apps with optional user registration and login.
Beta Feedback
Recipes by Category
App Distribution (13)
Bundle logic, interface and services for distribution.
App Logic (52)
The Apex programming language, workflow and formulas for logic.
Collaboration (7)
The Salesforce Chatter collaboration platform.
Database (29)
Data persistence, reporting and analytics.
Integration (57)
Web Service APIs and toolkits for integration.
Security (22)
Platform, application and data security.
Tools (17)
Force.com tooling
User Interface (38)
Visualforce MVC and metadata-drive user interfaces.
Web Sites (13)
Public web sites and apps with optional user registration and login.
Cookbook Home » An Email Utility Class to Avoid Boilerplate Code
Share
X
Vote to Verify a Recipe
Verifying a recipe is a way to give feedback to others and broaden your own understanding of the capabilities on Force.com. When you verify a recipe, please make sure the code runs, and the functionality solves the articulated problem as expected.
Please make sure:- All the necessary pieces are mentioned
- You have tested the recipe in practice
- Have sent any suggestions for improvements to the author
Please Log in to verify a recipe
You have voted to verify this recipe.
© Copyright 2000-2011 salesforce.com, inc. Web-based Customer Relationship Management (CRM) Software-as-a-Service (SaaS).
All rights reserved Various trademarks held by their respective owners.
All rights reserved Various trademarks held by their respective owners.
Salesforce.com, inc. The Landmark @ One Market, Suite 300, San Francisco, CA, 94105, United States
General Enquiries: 415-901-7000 | Fax: 415-901-7040 | Sales: 1-800-no-software
General Enquiries: 415-901-7000 | Fax: 415-901-7040 | Sales: 1-800-no-software

Recipe Activity - Please Log in to write a comment
@larkinrichards wow, you've extended my recipe and made it more comprehensive. I like it. Did you try to submit it to the cookbook? I'd recommend calling it EmailUtil ++ Definitely a thumbs up from me. :)
Thanks, this class was very useful for me.
I made a number of revisions to this code in order to facilitate behavior testing of triggers that send email, and I also added some features to facilitate sending bulk emails. I posted my revised version in the discussion forums here(4th post in thread): http://boards.developerforce.com/t5/Apex-Code-Development/Behavior-testing-a-sendEmail-statement/m-p/284331/highlight/false#M49675
Worked like a charm -- needed to add a method to retrieve object related attachments but other than that it works great.
Thanks Anup!
I'm using this recipe. Thanks
Great Sample!
used the recipe in our production environment, and so far haven't had any issues.
Hi, does anyone know how to divert the whole email in "Active History " to "Notes & Attachment" in the custom fields? Thanks.
That's a good Idea, Mark!
I'll update the code and re-post it.
Very nice use of chaining :-)
If you wanted to simplify this, you could:
Make the build() method private and have the sendEmail() method call build() since that appears to be the only time you'd ever want to build the email.
this is a great sample of genericizing commonly used code to provide better interfaces to the logic than the platform does by default.