You need to sign in to do that
Don't have an account?
Aidel Bruck
contentversion insert error
I have the following trigger that is obviously working (I checked the log), But no email is being sent out.
I check that the deliveribility is set to 'all emails'
Please advice
This is the code
trigger NewFileAlert on ContentDocument (after insert)
{
List<Messaging.SingleEmailMessage> mails =
new List<Messaging.SingleEmailMessage>();
for (ContentDocument newDoc : Trigger.new)
{
Messaging.SingleEmailMessage mail =
new Messaging.SingleEmailMessage();
List<String> sendTo = new List<String>();
sendTo.add(allthepeople@everybody.com);
...
mail.setToAddresses(sendTo);
mail.setReplyTo('me@gmail.com');
mail.setSenderDisplayName('Aidel Bruck');
mail.setSubject('New Document Added');
String body = 'Please note: A new document has been added/n ';
body += 'File name: '+ newdoc.title+'/n' ;
body += 'Created By: '+ newdoc.createdbyid+ '/n';
body += 'Created Date: '+ newdoc.CreatedDate+ '/n';
body += 'link to file: '+ System.URL.getSalesforceBaseUrl().getHost()+newdoc.id;
mail.setHtmlBody(body);
mails.add(mail);
}
Messaging.sendEmail(mails);
}
I check that the deliveribility is set to 'all emails'
Please advice
This is the code
trigger NewFileAlert on ContentDocument (after insert)
{
List<Messaging.SingleEmailMessage> mails =
new List<Messaging.SingleEmailMessage>();
for (ContentDocument newDoc : Trigger.new)
{
Messaging.SingleEmailMessage mail =
new Messaging.SingleEmailMessage();
List<String> sendTo = new List<String>();
sendTo.add(allthepeople@everybody.com);
...
mail.setToAddresses(sendTo);
mail.setReplyTo('me@gmail.com');
mail.setSenderDisplayName('Aidel Bruck');
mail.setSubject('New Document Added');
String body = 'Please note: A new document has been added/n ';
body += 'File name: '+ newdoc.title+'/n' ;
body += 'Created By: '+ newdoc.createdbyid+ '/n';
body += 'Created Date: '+ newdoc.CreatedDate+ '/n';
body += 'link to file: '+ System.URL.getSalesforceBaseUrl().getHost()+newdoc.id;
mail.setHtmlBody(body);
mails.add(mail);
}
Messaging.sendEmail(mails);
}
Please use below steps to check email limit in your org.
1. Ensure you are logged into the organization where you want to verify your limits.
2. Navigate to https://workbench.developerforce.com/login.php
3. Accept any oauth prompts to complete authentication
4. On the Jump to picklist select "REST Explorer".
5. Click Select.
6. From the options presented select: /services/data/vXX.0/limits
7. Click "Execute".
8. Select the SingleEmail area to view the daily maximum and remaining calls.
I tried to move the messaging.send() to an different class and called in asyncronously but I still don;t get it.