You need to sign in to do that
Don't have an account?
Geetha B
i am getting this error when i am trying to send email from apex
System.EmailException: SendEmail failed. First exception on row 0; first error: NO_MASS_MAIL_PERMISSION, Single email is not enabled for your organization or profile. Single email must be enabled for you to use this feature.: []
Error is in expression '{!sendEmail}' in component <apex:commandButton> in page selectcontactforcustomerfeedback: Class.sendEmail.sendEmail: line 28, column 1
here is the code
public with sharing class sendEmail
{
public Customer_Feedback__c cfc{get;set;}
Customer_Feedback__c cusfb = new Customer_Feedback__c();
public sendEmail(ApexPages.StandardController controller)
{
cfc = new Customer_Feedback__c();
}
public PageReference sendEmail()
{
cusfb.Contact__c = cfc.Contact__c;
insert cusfb;
system.debug('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'+cusfb);
Contact c = [select Name,Email from Contact where Id=: cusfb.Contact__c];
system.debug('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'+c);
Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
message.setSubject('A new External Case Comment has been posted');
message.setPlainTextBody(cusfb.Id);
message.setToAddresses(new String[] { c.Email });
Messaging.sendEmail(new Messaging.Email[] {message});
ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.info,'Registered Sucessfully, Feedback Security Code is sent to the Contact Email.');
ApexPages.addMessage(myMsg);
return null;
}
}
Error is in expression '{!sendEmail}' in component <apex:commandButton> in page selectcontactforcustomerfeedback: Class.sendEmail.sendEmail: line 28, column 1
here is the code
public with sharing class sendEmail
{
public Customer_Feedback__c cfc{get;set;}
Customer_Feedback__c cusfb = new Customer_Feedback__c();
public sendEmail(ApexPages.StandardController controller)
{
cfc = new Customer_Feedback__c();
}
public PageReference sendEmail()
{
cusfb.Contact__c = cfc.Contact__c;
insert cusfb;
system.debug('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'+cusfb);
Contact c = [select Name,Email from Contact where Id=: cusfb.Contact__c];
system.debug('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'+c);
Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
message.setSubject('A new External Case Comment has been posted');
message.setPlainTextBody(cusfb.Id);
message.setToAddresses(new String[] { c.Email });
Messaging.sendEmail(new Messaging.Email[] {message});
ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.info,'Registered Sucessfully, Feedback Security Code is sent to the Contact Email.');
ApexPages.addMessage(myMsg);
return null;
}
}
goto
Email Administration->Deliverability
check email settings.it must solve it,may be you have check system mail access,change that to All Emails
Thanks
D Naveen Rahul.
Please Check with access level.The access level might have been set to "system e-mails".
In setup | Administration setup | Email Administration | Deliverability, verify if the access level is set to "All e-mails".
The e-mail deliverability is a new feature released in spring 13 and as per the release notes, all newly refreshed sandboxes default to "system email only"
If this will help you out.Mark it for best answer to helps others :)
Thanks