question

HOAL avatar image
1 Vote"
HOAL asked ·

Change email sender name in Microsoft Graph API is not working

First, Thank you for adding chatbots to your web interfaces that help us ask questions and getting answers quickly like each and every website in the world, instead of searching for half an hour trying to find a way to contact you !!

Now, my question is:

I am using Microsoft Graph rest API v1.0 in order to send emails from our solution. I am using postman application for testing and emails are being sent successfully. The problem is that we want to use object "from" to send email from another sender and by setting another name; The administrator has granted access to send email as another user and it worked successfully, but I am unable to change the sender name; Below is an example of the body parameters:

 {
   "message": {
     "subject": "Test",
     "body": {
       "contentType": "Html",
       "content": "Hello, this is a test to check the sender's name"
     },
    "from": {
         "emailAddress": {
         "name" :"No Replyy",
           "address": "noreply@.."        
         }
     },
     "toRecipients": [
       {
         "emailAddress": {
           "address": "..."
         }
       }
     ]
   }
 }

The email is being sent using noreply@.. but the email name is not changing to "No Replyyy"; Can you help me to solve the issue?

Thank you in advance.




azure-ad-graph
· 1
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@HOAL Have you had a chance to try below API call?

0 Votes 0 ·

1 Answer

amanpreetsingh-msft avatar image
0 Votes"
amanpreetsingh-msft answered ·

Hello @HOAL I tested below call and it worked perfectly for me:


Call: POST https://graph.microsoft.com/v1.0/me/sendMail


Body: {"message":{"subject":"Meet for lunch at 3?","body":{"contentType":"Text","content":"The new cafeteria is open."},"toRecipients":[{"emailAddress":{"address":"receiver@example.com"}}],"from":{"emailAddress":{"address":"obouser@mytenant.onmicrosoft.com"}}},"saveToSentItems":"false"}


Additional info:


From O365 portal added User1 to the properties of obouser under SendAs and SendOnBehalf mailox permissions.


Logged in with User1@mytenant.onmicrosoft.com at https://developer.microsoft.com/en-us/graph/graph-explorer.


Used above call to send the email.


Verified that receiver@example.com received email from obouser and not from User1.


Removed the from parameter from the body and confirmed that the recipient received the email from User1.



Please do not forget to "Accept the answer" wherever the information provided helps you. This will help others in the community as well.


· 2 · Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I think @HOAL is asking for the [NAME] in from email field,
@amanpreetsingh-msft your request is missing this part.


And I am facing the exactly same issue as @HOAL , the From name is not honored.


No matter what From name I changed to, it will always show your profile name (I guess) .


Not sure this is some security limitation or just a bug.


We can change From Name in old Exchange API or Other email provider API (GMAIL).



1 Vote 1 ·

Yes, it picks up the profile name and doesn't use the name specified in the body of the post call. You can post a feedback regarding this at https://feedback.azure.com.

0 Votes 0 ·