0

I have created the account Record in salesforce,for every Record creation the email should send to a particular user email id,Suppose if the Record is created with morethan 10 users also, the email should send to the particular user

Normally for single user limit is 10 emails / day, how to overcome this 10 emails / day to single user using Mass Email Template anyone Guide Me for the Answer If any apex class it is possible

1

1 Answer 1

1

This depends on your Org Edition. If you're using a Developer Edition, you're limited to:

In Developer Edition orgs and orgs evaluating Salesforce during a trial period, you can send mass email to no more than 10 external email addresses per day. This lower limit doesn’t apply if your org was created before the Winter ’12 release and already had mass email enabled with a higher limit. Additionally, your org can send single emails to a maximum of 15 email addresses per day.

Unless you buy a full edition, you're stuck with this.

If you are using a full Org and calling Messaging.sendEmail, you can only invoke it 10 times in a single transaction, meaning rather than doing something like this 10 times over...

Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();

message.setToAddress(new List<String>{'someone@somewhere.com'});
message.setSubject('Hello World!');
message.setHtmlBody('<p>Lorem ipsum dolor sit amet.<p>');

Messaging.SendEmailResult[] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});

You would need to bulkify it, something like below:

List<Messaging.SingleEmailMessage> messageList = new List<Messaging.SingleEmailMessage>();

for (Integer i = 0; i < 100; i++) {
  Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();

  message.setToAddress(new List<String>{'someone@somewhere.com'});
  message.setSubject('Hello World!');
  message.setHtmlBody('<p>Lorem ipsum dolor sit amet.<p>');

  messageList.add(message);
}

Messaging.SendEmailResult[] r = Messaging.sendEmail(messageList);

Albeit iterating over a Set<String> of e-mail addresses and/or using other Message methods like setTargetObjectId.

You'll still use SingleEmailMessage limits (e.g. if your limit is 5000, you'll be down to 4900 for the day), but the governor limit for sendEmail(messageList) would only be 1/10 for this transaction.

5
  • @user36188 It's not possible using a Developer edition unfortunately. Salesforce will enforce stricter limits on sending e-mails for free accounts. They want your money. ;) What you can do is test the concept though.
    – Dan Jones
    Nov 22, 2016 at 9:32
  • If you've bought an edition then yes, it's absolutely possible with sandbox or production, to a point. What I mean by that is using the API or Apex, you can send single emails to a maximum of 5,000 external email addresses per day.
    – Dan Jones
    Nov 22, 2016 at 9:36
  • Can you guide me the apex class answer for my scenario,I am also using sandbox also ,for every account record creation mail should send to particular user ,or If i am creating the contact with the particular account mail should send to contact mail address,can you send the apex class for my scenario @Dan jones I am new to mass email ,guide me answer for my immediate requirement
    – SFDC
    Nov 22, 2016 at 9:39
  • @user36188 Honestly for that scenario I'd use a Workflow or Process Builder.
    – Dan Jones
    Nov 22, 2016 at 9:40
  • @user36188 you'd need to probably write a new question, I can't write an entire class for you but I can help you with specific problems with your code. You can look at the MassEmailMessage Class and other questions here on SFSE.
    – Dan Jones
    Nov 22, 2016 at 10:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.