Share via

How to request read receipt for a email sent using Graph API sendEmail

ManojKumar Dharmar 1 Reputation point
2022-01-06T14:54:56.297+00:00

In our product we are integrating email sending using Microsoft Graph API. We are able to send and receive emails successfully using the Graph SDK.

But we are not able to get Read Receipt for the mails.

As per the below mentioned docs, tried enabling "isReadReceiptRequested"

https://learn.microsoft.com/en-us/graph/api/resources/message?view=graph-rest-1.0

The same parameter when enabled using Microsoft explorer works as expeceted.

The issue is found only with the SDK

Any help would be appreciated.

Microsoft Security | Microsoft Graph
0 comments No comments

1 answer

Sort by: Most helpful
  1. JanardhanaVedham-MSFT 3,581 Reputation points
    2022-01-06T20:49:06.913+00:00

    Hi @ManojKumar Dharmar ,

    I tested "isReadReceiptRequested" property using Send mail Microsoft Graph API in both Graph Explorer and Postman tool and it is working as expected. You can try using the below equivalent Graph SDK code base by setting up the "isReadReceiptRequested" property at the start of the request body in the code (as shown below).

    Microsoft Graph C#.NET SDK ( sample code) :

    GraphServiceClient graphClient = new GraphServiceClient( authProvider );  
      
    var message = new Message  
    {  
    	IsReadReceiptRequested = true,  
    	Subject = "Email Read Receipt Requested",  
    	Body = new ItemBody  
    	{  
    		ContentType = BodyType.Text,  
    		Content = "Read Receipt Test"  
    	},  
    	ToRecipients = new List<Recipient>()  
    	{  
    		new Recipient  
    		{  
    			EmailAddress = new EmailAddress  
    			{  
    				Address = "******@o365XXXX.onmicrosoft.com"  
    			}  
    		}  
    	}  
    };  
      
    await graphClient.Me  
    	.SendMail(message,null)  
    	.Request()  
    	.PostAsync();  
    

    Microsoft Graph JavaScript SDK ( sample code) :

    const options = {  
    	authProvider,  
    };  
      
    const client = Client.init(options);  
      
    const sendMail = {message: {isReadReceiptRequested: true,subject: 'Email Read Receipt Requested',body: {contentType: 'Text',content: 'Read Receipt Test'},toRecipients: [{emailAddress: {address: '******@o365XXXX.onmicrosoft.com'}}]}};  
      
    await client.api('/me/sendMail')  
    	.post(sendMail);  
    

    My testing outcome in Postman/Graph Explorer using Send mail Graph API :

    162976-image.png
    162983-image.png
    162927-image.png
    Hope this helps.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it, so that it will be useful for other community users. If you have any further questions about this answer, please click "Comment".

    2 people found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.