1

I have developed a pretty cool, reusable piece of apex code that allows a user to define which fields on a given object that are of interest when field values change. When a field changes on an object that a user is interested in, the change data is archived to a custom object and an email is sent out. I am hitting the limit of 1,000 apex emails per day. I was wondering if there was a way to take a proactive approach to monitor the number of emails sent in a 24 hour period. I see there is a Limits apex class but that only shows the current count for a given transaction. Does anyone know of a method that I can use to get the current count of emails send in a 24 hour period rather than me writing something that is custom to keep track of a count? I can't believe SFDC limits us to only 1,000 emails. Kinda defeats the purpose of doing real time alerting via email. I read somewhere I may be able to create an internal email in SFDC that doesn't count against this limit. I may have to do that instead if I can't find a viable work around. Thanks, Ryan

1

Problem is that you are setting up your email request as external address rather than email your internal users instead.

You can send an unlimited amount of email to your organization’s internal users, which includes portal users. Resource Link

Correct way to doing it:

Messaging.SingleEmailMessage emailMsg = new Messaging.SingleEmailMessage();  
emailMsg.setTargetObjectId(internalUserId);
//must be false if sending to internal user    
emailMSg.saveAsActivity = false; 
emailMsg.setSenderDisplayName('sender name');  
emailMsg.setSubject('some subject');  
emailMsg.setBccSender(false);  
emailMsg.setUseSignature(false);  
emailmsg.setPlainTextBody('email body');  
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { emailMsg });

Resource Link

| improve this answer | |

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.