Home › Forums › Modern DFFS › Make sure email has a valid recipient
Tagged: email
- This topic has 5 replies, 2 voices, and was last updated 1 month, 2 weeks ago by Alexander Bautz.
-
AuthorPosts
-
-
October 2, 2024 at 19:57 #38124
Hi Alex,
I am encountering an error while trying to send an email from DFFS. Error pop up shows message “The e-mail cannot be sent. Make sure the e-mail has a valid recipient. Here is the setup.
Form: Edit form
Trigger: before save
Actions: Prepare an email
Email has all the required fields. Its a simple test list. When an item is saved
– I see the following in network tab
Request URL: https://xxxx.sharepoint.com/sites/xxxx/_api/SP.Utilities.Utility.SendEmail
Request Method: POST
Status Code: 400 Bad Request
Payload: {“properties”:{“To”:[“webadmin@ltp.org”],”Subject”:”Test email”,”Body”:”test email”}}Response is
{
“odata.error”: {
“code”: “-2130242040, Microsoft.SharePoint.SPException”,
“message”: {
“lang”: “en-US”,
“value”: “The e-mail message cannot be sent. Make sure the e-mail has a valid recipient.”
}
}
}Please advise
-
October 2, 2024 at 21:54 #38126
Hi,
Is the email address in the “To” field a valid user in the same domain as the SharePoint site where you are sending the email?Alexander
-
October 3, 2024 at 00:10 #38128
Hi Alex,
Yes, it’s a valid user account in the same domain. Does the user/email need to have access to the SharePoint site to receive emails? The power automate flow I set up worked with the email address that is failing with DFFS.
-
October 3, 2024 at 07:05 #38130
When using the SP.Utilities.Utility.SendEmail endpoint the user must be in the User information list in the SiteCollection for it to work (must be added to a SharePoint group).
I’ll take a look and see if I might be able to run ensureUser on the person in the To-field (to add the user if it is not already in the User Information list) before processing the email in a later version.
Alexander
-
October 3, 2024 at 13:31 #38132
Thank you for looking into this. So does that mean:
– We cannot send an email to a email distribution group where there is no actual login?
– We cannot send email to external email addresses? (Example a vendor email address)Also is there a way to send email as a particular email address? (Set the From email address)
-
October 3, 2024 at 16:14 #38134
Hi,
Yes, this means these email can only be sent to users registered in the SharePoint site collection. To send to a distribution list using this email method you will have to convert it to a mail enabled security group.It is not possible to change the “From” address.
To be able to send to external / non-members of the site collection you must set up a FLOW and process the email there.
This is not limitations in DFFS, but in the built-in SharePoint REST API used to process the emails.
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.