Skip to main content

Hi @all, 

 

I am facing one issue in sending the email/apex email from standard user. Please find the below step that I have configured. 

 

1. create an Email Service in Salesforce without specifying Accept Email From in Email Service as well as Email Address setup only the context user is present there who is system admin.

2. Written this below piece of code in apex 

 

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

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

List<String> sendTo = new List<String>();

sendTo.add('Email Service Address');

mail.setToAddresses(sendTo);

String joinIds = appId + '-' + UserInfo.getUserId();

mail.setSubject(joinIds);

mail.setPlainTextBody(joinIds);

mails.add(mail);

Messaging.sendEmail(mails);

 

All of the variable has fields permission with the Standard profile. 

 

I am hitting this piece for code by clicking on a button on a record through lwc implemented in Aura Bundle but it is not sending the email so my inbound email service is not running the logic. 

 

It is working as expected when I am performing the actions through system admin not sure what is happening can anyone help?

 

Regards 

Hitesh Khatri

0/9000