I have a custom button that calls a function which sends an email using an email template.
The button works as intended, but only with the from address zoho.adminuserid. I want this email to come from the user pressing the button, but when I set the from address to zoho.loginuserid, I get this error:
{"data":[{"code":"INVALID_DATA","details":{"api_name":"email","json_path":"$.data[0].from.email"},"message":"Email can't be sent using this from address.Kindly check the allowed from address list","status":"error"}]}
You can specify the system variable zoho.loginuserid as long as the user is not a customer portal user. If the user is a portal user, the email address has to be verified before it can be used as the FROM address.
Since the button/function/email template are working and the zoho.loginuserid is a valid address, why am I getting an error?
emailTemplateId = 2050955000064358113;
from_name = "Test User";
from_email = zoho.loginuserid;
email_subject = null; //the subject gets overwritten by email template subject
template_data = {"id":emailTemplateId};
emailData = {"data":{{"from":{"user_name":from_name,"email":from_email},"to":{{"email":to_email}},"subject":email_subject,"mail_format":"html","template":template_data}}};
sendEmailResp = invokeurl
[
type :POST
parameters:emailData.toString()
connection:"send_crm_email_template"
];