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

Automatically send mass email?

I need to automatically send a mass email each day to anyone who became a contact 7 days prior. I can do this manually by using "Mass Email Contacts" and creating a view that shows only contacts with a Created Date of 7 days ago, but I need to do it automatically, every day, for each user's contacts.

So far, the best way I've come up with is to have our server access the API, query for contacts created x days ago, send mass email (in batches of 10 emails), then login as the next user, and repeat.

This seems really inefficient -- but I'm very new to Salesforce, so I'm hoping there's an easier way that I don't know about.

Has anybody solved this problem already?


As of Summer '07 release, scheduled for August, you will be able to accomplish this using time -based workflow. The change is that Summer '07 allows workflow emails to go to contact email addresses.


Thanks, Mike -- that's good news. Unfortunately, I need to get something up and running right away, so I can't wait for the new release. Do you know if there's a "best practice" way to do this using the current software?
Then the using the API from your server is probably the way to go but you don't need to login as each user. You should be able to log in as an administrator and access all the applicable contacts. I suppose that you are scheduling the job to run daily.
Yes, I planned to schedule the job daily on my server.

If I log in as the administrator, and send mail to all of Bob's contacts using sendMail(), how do I make the emails seem to come from Bob, instead of me?

(Also, does anybody know when the update to Salesforce is scheduled to come online? Is it August like "definitely August 1", or more like "probably sometime in August, but it might be September"?)
According to the Dreamforce Developer Preview presentation here the rollout will start on Aug 3 and be completed within 2 weeks. However with the time-based workflow solution I think you will still have the same problem with all emails having the same from address.

Mass mail is available from API 9.0 . Check in new AJAX tool kit (Connection.js) file. Following is the code from that file. Hope this will help. 


sforce.Email = function() {


sforce.Email.prototype = new sforce.Xml("messages");

sforce.MassEmailMessage = function() {


sforce.MassEmailMessage.prototype = new sforce.Xml("messages");

sforce.MassEmailMessage.prototype._xsiType = "MassEmailMessage";



sforce.SingleEmailMessage = function() {


sforce.SingleEmailMessage.prototype = new sforce.Xml("messages");

sforce.SingleEmailMessage.prototype._xsiType = "SingleEmailMessage";