2

I am having trouble with sending emails via REST in javascript following the answer in this question:

Send E-mail from javascript using REST API

My issue is that emails, for some users, are only sent successfully if they are in the format domain\\user or the 'To' property. Other users this will not work and their actual email address , username@somesite.com, must be used.

Emails from alerts and workflows work without issue.

MickB
  • 1,491
  • 1
  • 18
  • 35

1 Answers1

3

Searching users in powershell would return two users for some people. Using the cmdlet:

Get-SPUser -web http://somesite.com | ?{$_.DisplayName -eq "john doe"}

Results:

UserLogin                    DisplayName   
---------                    -----------   
i:0#.w|domain\john-doe       John Doe
DOMAIN\john-doe              John Doe

The email address would be the same for both spusers. When attempting to send the email using john-doe@somesite.com I believe there was a conflict when trying to resolve the email to a single user and would result in error.

Changing the 'To' addresses to the format i:0#.w|domain\\username resolved the issue and I was able to send emails to any spuser successfully.

MickB
  • 1,491
  • 1
  • 18
  • 35