Make sure email has a valid recipient

Home Forums Modern DFFS Make sure email has a valid recipient

Tagged: 

Viewing 5 reply threads
  • Author
    Posts
    • #38124
      Amal Vellappillil
      Participant

        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

      • #38126
        Alexander Bautz
        Keymaster

          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

        • #38128
          Amal Vellappillil
          Participant

            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.

          • #38130
            Alexander Bautz
            Keymaster

              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

            • #38132
              Amal Vellappillil
              Participant

                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)

              • #38134
                Alexander Bautz
                Keymaster

                  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

              Viewing 5 reply threads
              • You must be logged in to reply to this topic.