Can't send emails to custom domains (non-gmail/hotmail emails) using Mailgun - ruby-on-rails

I am sending out confirmation (and other emails) when users sign up. The problem is that when I send to addresses that are not gmail or hotmail or any of the larger email services, it throws me an error in the email header.
{
"severity": "permanent",
"tags": [],
"delivery-status": {
"tls": false,
"mx-host": "mxer.customdomain.com",
"code": 553,
"description": null,
"session-seconds": 6.566637992858887,
"message": "553 5.1.8 <user#customdomain.com>... Domain of sender address bounce+e06614.0f9698-user=customdomain.com#mg.mydomain.com does not exist",
"certificate-verified": false
},
"envelope": {
"transport": "smtp",
"sender": "accounts#mydomain.com",
"sending-ip": "123.45.678.900",
"targets": "user#customdomain.com"
},
"recipient-domain": "customdomain.com",
"id": "AbCDeFGhiJk_lMn",
"campaigns": [],
"reason": "generic",
"user-variables": {},
"flags": {
"is-routed": null,
"is-authenticated": true,
"is-system-test": false,
"is-test-mode": false
},
"log-level": "error",
"timestamp": 1456123374.411238,
"message": {
"headers": {
"to": "First Last <user#customdomain.com>",
"message-id": "56caade72ed26_***********9#6e5120c5-0d27-4491-a430-1a2dc4e6b862.mail",
"from": "Team Accounts <accounts#mydomain.com>",
"subject": "Confirmation instructions"
},
"attachments": [],
"recipients": [
"user#customdomain.com"
],
"size": 1143
},
"recipient": "user#customdomain.com",
"event": "failed"
}
Did I set my headers wrongly or is there a configuration I need to set up before I can send emails to custom domains?

It seems that for some email services, it requires a valid "receive" MX record for your domain/subdomain (for Mailgun it was mg.mydomain.com) to verify the identity of the sender. I added the MX records
10 mxa.mailgun.org
10 mxb.mailgun.org
for mg.mydomain.com and it seemed to have worked.

Related

How to find parent_message_id of reply message in graph api

I mean that Incoming reply mail is which mail reply,
To find this I want parent_message_id by using this I'm easily find parent_mail.
below code is respone of reply mail.
I want to find It's parent mail means below mail is which mail reply
To find parent mail I want parent_mail_id How can I find this ?
{
"#odata.etag": "W/\"CQAAABYAAABexZ50mSS0TKajvW/Uc3jZAAAhk64J\"",
"id": "AQMkADAwATM3ZmYAZS01OWRhLTM5MjgtMDACLTAw....",
"createdDateTime": "2023-02-02T08:39:59Z",
"lastModifiedDateTime": "2023-02-02T08:40:01Z",
"changeKey": "CQAAABYAAABexZ50mSS0TKajvW/Uc3jZAAAhk64J",
"categories": [],
"receivedDateTime": "2023-02-02T08:40:00Z",
"sentDateTime": "2023-02-02T08:39:46Z",
"hasAttachments": false,
"internetMessageId": "<CAJjLavQHv0SDMHxiKpRUCE=NU9X4AnL2QfPKjLJMbPeudvNP-A#mail.gmail.com>",
"subject": "Re: Meet for lunch 12:40?",
"bodyPreview": "12:40 reply mail\r\n\r\nOn Thu, 2 Feb 2023 at 13:06, ** <****#outlook.com> wrote:\r\nThe new cafeteria is open.",
"importance": "normal",
"parentFolderId": "AQMkADAwATM3ZmYAZS01OWRhLTM5MjgtMDACLTAwCgAuAAADNqdil3J7jU_HbfQfdBJYbQEAXsWedJkktEymo71v1HN42QAAAgEMAAAA",
"conversationId": "AQQkADAwATM3ZmYAZS01OWRhLTM5MjgtMDACLTAwCgAQAAo6snnrhhJOv0qLJ4Io1Fo=",
"conversationIndex": "AQHZNtkeCjqyeeuGEk6/SosngijUWq67VhwA",
"isDeliveryReceiptRequested": null,
"isReadReceiptRequested": false,
"isRead": false,
"isDraft": false,
"webLink": "https://outlook.live.com/owa/?ItemID=AQMkADAwATM3ZmYAZS01OWRhLTM5MjgtMDACLTAwCgBGAAADNqdil3J7jU%2BHbfQfdBJYbQcAXsWedJkktEymo71v1HN42QAAAgEMAAAAXsWedJkktEymo71v1HN42QAAACGV0fkAAAA%3D&exvsurl=1&viewmodel=ReadMessageItem",
"inferenceClassification": "focused",
"body": {
"contentType": "html",
"content": "<html><head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"></head><body><div dir=\"ltr\">12:40 reply mail </div><br><div class=\"gmail_quote\"><div dir=\"ltr\" class=\"gmail_attr\">On Thu, 2 Feb 2023 at 13:06, ** <***#outlook.com> wrote:<br></div><blockquote class=\"gmail_quote\" style=\"margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex\">The new cafeteria is open.</blockquote></div></body></html>"
},
"sender": {
"emailAddress": {
"name": "****",
"address": "***#gmail.com"
}
},
"from": {
"emailAddress": {
"name": "****",
"address": "****"
}
},
"toRecipients": [
{
"emailAddress": {
"name": "***",
"address": "****#outlook.com"
}
}
],
"ccRecipients": [],
"bccRecipients": [],
"replyTo": [],
"flag": {
"flagStatus": "notFlagged"
}
},
I've send mail by using /sendMail graph api and for this sent mail I've reply mail by using other platform(ex:gmail) ,So how can I know incoming message parent message I mean which message reply is it
You need to take the conversationId from your message and filter messages by conversationId
GET https://graph.microsoft.com/v1.0/me/messages?$filter=conversationId eq '{conversation_id}'
Then order the messages by conversation index. The property conversationIndex does not support filtering on the server, so you need to order messages on the client as a string.
From ordered messages you are able to get the parent message.
There Isn't Any way to find parent_id by using reply mail response , In response provide parent_folderId but It Isn't useful to find parent_id
There Is one way to find parent_id If parent and reply messages have same conversation-id but Isn't then It cannot be possible to find the correct parent message

Not getting any webhook notification for Microsoft O365 Management APIs

I have created the below webhooks and all are enabled.:
[
{
"contentType": "Audit.AzureActiveDirectory",
"status": "enabled",
"webhook": {
"authId": "12345",
"address": "https://978b7cfb66d9.ngrok.io/callback/",
"expiration": "",
"status": "enabled"
}
},
{
"contentType": "Audit.General",
"status": "enabled",
"webhook": {
"authId": "12345",
"address": "https://978b7cfb66d9.ngrok.io/callback/",
"expiration": "",
"status": "enabled"
}
},
{
"contentType": "Audit.SharePoint",
"status": "enabled",
"webhook": {
"authId": "12345",
"address": "https://978b7cfb66d9.ngrok.io/callback/",
"expiration": "",
"status": "enabled"
}
}
]
I don't see any notifications coming when there are changes made in sharepoint. Anything in particular need to change?
From the access token, I do see correct app permissions:
"roles": [
"ServiceHealth.Read",
"ActivityFeed.Read"
]
I manually queried to get content and it shows empty.
https://manage.office.com/api/v1.0/{tenant-guid}/activity/feed/subscriptions/content?contentType=Audit.Sharepoint
Looks like the auditing for Office 365 organization is disabled.
Make sure you turn on audit log search.

Unable to retrieve event details using Microsoft Graph API 1.0

Has anyone got Microsoft Graph API working for EventMessage? i.e reading email content of EventMessage using Graph API.
Looks like it has actionable card and graph API 1.0 is not able to read it.
Provided delegate access to user for a room resource.
On event creation for that room, mail is received by the delegated user in inbox. The mail type is eventMessage ("#odata.type": "#microsoft.graph.eventMessage").
On fetching the mail through GraphAPI v1.0, the event values are not visible in the response.
Also on setting the Expand property for the mail in graph API as per docs, results in below error.
{ "error": {
"code": "BadRequest",
"message": "Parsing Select and Expand failed.",
"innerError": {
"request-id": "310bbcce-bdd8-4cb6-890c-035243a5ab6d",
"date": "2020-01-21T09:18:10"
}
}
}
I'm unable to repro your issue. The Microsoft Graph API returns details for event messages. Can you provide repro steps, request/response capture, and the values that you'd expect to see?
I used v1.0/me/messagesto get all of the messages to find an eventMessage. I then perform the following to get details on the eventMessage:
GET https://graph.microsoft.com/v1.0/me/messages/{messagedId}
Response body:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('d09-94-498-a9777d4b')/messages/$entity",
"#odata.type": "#microsoft.graph.eventMessage",
"#odata.etag": "W/\"DAA2pU9s\"",
"id": "AAMkADEzOTExYjJkAAA=",
"createdDateTime": "2020-01-24T14:47:24Z",
"lastModifiedDateTime": "2020-01-24T21:08:07Z",
"changeKey": "DApU9s",
"categories": [],
"receivedDateTime": "2020-01-24T14:47:25Z",
"sentDateTime": "2020-01-24T14:47:11Z",
"hasAttachments": false,
"internetMessageId": "<AM5P3M#A38.EURPRD83.prod.outlook.com>",
"subject": "Accepted: Microsoft Graph DevX Roadmap",
"bodyPreview": "",
"importance": "normal",
"parentFolderId": "AAMk3AAA=",
"conversationId": "AAQkADEzOU4=",
"conversationIndex": "AdXReVPepTg==",
"isDeliveryReceiptRequested": null,
"isReadReceiptRequested": false,
"isRead": true,
"isDraft": false,
"webLink": "https://outlook.office365.com/owa/?ItemID=AAMkA%3D&exvsurl=1&viewmodel=ReadMessageItem",
"inferenceClassification": "focused",
"meetingMessageType": "meetingAccepted",
"body": {
"contentType": "text",
"content": ""
},
"sender": {
"emailAddress": {
"name": "Nicole",
"address": "sig#contoso.com"
}
},
"from": {
"emailAddress": {
"name": "Nicole",
"address": "sig#contoso.com"
}
},
"toRecipients": [
{
"emailAddress": {
"name": "Michael Mainer",
"address": "mm#contoso.com"
}
}
],
"ccRecipients": [],
"bccRecipients": [],
"replyTo": [],
"flag": {
"flagStatus": "notFlagged"
}
}

Create a JIRA ticket via service desk api

I am trying to create a ticket in JIRA by following https://docs.atlassian.com/jira-servicedesk/REST/3.6.2/#servicedeskapi/request-createCustomerRequest
I send a post request to https:/x.atlassian.net//rest/servicedeskapi/servicedesk/request
With following json param
{
"serviceDeskId": “1”,
"requestTypeId": “1”,
"requestFieldValues": {
"summary": "Request raised via service REST API",
"description": "test."
}
}
But it replied with 404 error
{
"errorMessage": "Invalid project key 'request'",
"i18nErrorMessage": {
"i18nKey": "sd.error.project.by.key.not.found",
"parameters": [
"request"
]
}
}
Update - the service desk id and request type id got from a response of rest/servicedeskapi/request/{issueid}. Therefore values used for service desk id request type id can not be wrong
I tried servicedesk/1/requesttype/1/field and I received
{
"requestTypeFields": [
{
"fieldId": "summary",
"name": "Subject",
"description": "",
"required": true,
"defaultValues": [],
"validValues": [],
"jiraSchema": {
"type": "string",
"system": "summary"
}
},
{
"fieldId": "description",
"name": "Body",
"description": "",
"required": false,
"defaultValues": [],
"validValues": [],
"jiraSchema": {
"type": "string",
"system": "description"
}
}
],
"canRaiseOnBehalfOf": true,
"canAddRequestParticipants": true
}
I am not able to understand what am I missing. Can someone please advice
Issue was with the url. There is an unnecessary 'servicedesk' in the url.
After removing that it worked.
https:/x.atlassian.net//rest/servicedeskapi/request

Microsoft graph API: empty BCC field

Scenario:
Jenny and Tom have gmail accounts. Jerry is o365 user
Jenny sends email to Tom (in TO: field) and BCC: Jerry.
When Jerry gets message from graph api and doesn't see himself in BCC entry, which is empty (in both versions of API - 1 and beta).
If Jenny, Jerry and Tom would be in the group and Jenny have sent email to group, it would exactly the same for Jerry. There is no way to distinguish those two cases.
I would expect that when user is in BCC he should see himself there.
I know if sender is O365 user and getsMessage via graph API he will see all BCC users.
Is there any API call that I could use to learn that given user was in BCC of given message?
Here is what Jerry sees:
{
"#odata.etag": "W/\"CQAAABYAAACWhXAbJxpFRb0V3o8I2vIPAACwRstA\"",
"id": "AAMkAGMyNDE4NGI5LTRlNmItNDUzMy04ZTBlLTgxNjM3MDZhODE5NgBGAAAAAABT6x1NTxG_S7bw4uHJw-_tBwDEbTtXm_E6Rr8LT_x2xj5KAAAAnJfJAACWhXAbJxpFRb0V3o8I2vIPAACwGG_qAAA=",
"createdDateTime": "2017-11-15T19:50:57Z",
"lastModifiedDateTime": "2017-11-15T19:50:57Z",
"changeKey": "CQAAABYAAACWhXAbJxpFRb0V3o8I2vIPAACwRstA",
"categories": [],
"receivedDateTime": "2017-11-15T19:50:57Z",
"sentDateTime": "2017-11-15T19:50:54Z",
"hasAttachments": false,
"internetMessageId": "<CAHF5u5KsOQd43c4dtnx0uTQRor_dt7Y1uy=F3G4i6-c+TdUgug#mail.gmail.com>",
"subject": "test bcc=",
"bodyPreview": "test bcc",
"importance": "normal",
"parentFolderId": "AAMkAGMyE4NGI5LTRlNmItNDUzMy04ZTBlLTgxNjM3MDZhODE5NgAuAAAAAABT6x1NTxG_S7bw4uHJw-_tAQDEbTtXm_E6Rr8LT_x2xj5KAAAAnJfJAAA=",
"conversationId": "AAQkAGMyGI5LTRlNmItNDUzMy04ZTBlLTgxNjM3MDZhODE5NgAQAMaAYzrmsyxGq7ZujLh23q0=",
"conversationIndex": "AQHTXxoBjOuazLEartm6MuHberQ==",
"isDeliveryReceiptRequested": null,
"isReadReceiptRequested": false,
"isRead": false,
"isDraft": false,
"webLink": "https://outlook.office365.com/owa/?ItemID=AAMkAGMyNDE4NAACwGG%2BqAAA%3D&exvsurl=1&viewmodel=ReadMessageItem",
"inferenceClassification": "focused",
"unsubscribeData": [],
"unsubscribeEnabled": false,
"body": {
"contentType": "html",
"content": "<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n<meta content=\"text/html; charset=utf-8\">\r\n</head>\r\n<body>\r\n<div dir=\"ltr\">test bcc<br>\r\n</div>\r\n</body>\r\n</html>\r\n"
},
"sender": {
"emailAddress": {
"name": "Jenny",
"address": "jenny1234#gmail.com"
}
},
"from": {
"emailAddress": {
"name": "Jenny",
"address": "jenny1234#gmail.com"
}
},
"toRecipients": [
{
"emailAddress": {
"name": "Tom",
"address": "tom1234#gmail.com"
}
}
],
"ccRecipients": [],
"bccRecipients": [],
"replyTo": [],
"mentionsPreview": null,
"flag": {
"flagStatus": "notFlagged"
}
},
For any messages that comes from an external source (in this case GMail), there is no BCC data available.
This works this way in order to meet the requirements set forth for "Blind Carbon Copy" in RFC 2822.

Resources