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 , [email protected], must be used.

Emails from alerts and workflows work without issue.

2
  • Can you post the script you are using?
    – jpollar
    Jan 15, 2016 at 20:17
  • You should able be passing email addresses to the To parameter. Are you passing something else?
    – jpollar
    Jan 15, 2016 at 21:23

1 Answer 1

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 [email protected] 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.

2
  • Now to figure why some people have two accounts
    – MickB
    Jan 15, 2016 at 21:39
  • super cool! please post your findings here! Thanks!
    – Vamsi K K
    Jan 15, 2016 at 23:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.