This is more of question , When I sent an email using api , I received header like this
Connection: keep-alive
X-Message-Id: AOb5ZXUgSEeRAymhwhEySA
Date: Thu, 14 Jul 2016 04:43:58 GMT
Server: nginx
is there any significance of X-Message-Id, I would like to see if I can store it in database and later query this for stats?
`
dynamic sg = new SendGridAPIClient(key);
var from = new Email("[email protected]");
var subject = "Hello World from the SendGrid CSharp Library";
var to = new Email("[email protected]");
var content = new Content("text/plain", "Textual content");
var mail = new Mail(from, subject, to, content);
dynamic response = sg.client.mail.send.post(requestBody: mail.Get());
var result = response.Body.ReadAsStringAsync().Result;
var headers = response.Headers.ToString();
`
I have followed up with sendgrid on this, X-Message-Id should always be the same as the sg_message_id in the webhook.
so there is no other api to call for getting states for messageid, you need to write webhook to process, it
let me know if some one wants more info on the same
This issue can be closed
So there is no call to query for stats on a particular message ID (ie. https://api.sendgrid.com/v3/resource?sg_message_id=
@mmonroe86,
No, but a work around would be to use categories:
https://sendgrid.com/docs/API_Reference/Web_API_v3/Categories/categories.html
https://sendgrid.com/docs/API_Reference/Web_API_v3/Stats/categories.html
@thinkingserious thanks for the work around. Seems doable.
This seems highly bizarre. Why not send back an actual RESTful resource that contains an ID rather than sending the ID back in a header? Seems like lead engineer opinions > developer usability
Thanks for the feedback @thebigredgeek!
I've submitted this to our product team for consideration.
Today while debugging i found that 'x-message-id' (in api response) almost matches with 'smtp-id' (in event)
But no corelation with sg_message_id
For example, i got x-message-id as 'yfz2s5F_QySzdnBzVD1eHA'
and in webhook, i got smtp-id as 'yfz2s5F_QySzdnBzVD1eHA@ismtpd0002p1iad1.sendgrid.net'
and in webhook, i got sg_message_id as 'filter1081p1mdw1-23876-592CAABE-41.0'
@palamccc I submitted this same issue to SendGrid a long back but they wont believe it as issue (Never got a chance to explain it properly).
I hope this is your use case too, if you are sending it out to incorrect email address for first time,it will be return bounce message id which is correct. but if you are trying to send out another message then webhook starts with filter.
the workaround it to remove any part after @ in smtp-id you got in webhook it will always same as x-message-id
var response = client.SendEmailAsync(msg).Result;
var D_Body = response.DeserializeResponseBodyAsync(response.Body);
var D_Header = response.DeserializeResponseHeaders(response.Headers);
var Message_ID = response.Headers.Single(x => x.Key == "X-Message-Id").Value.ToList();
@thinkingserious
Hello,
is there a way to map X-MESSAGE-ID from POST mail/send with GET /messages query=msg_id="MESSAGE ID FROM X-MESSAGE-ID" ? why this does not work?
Im not sure, I normally store the mesages locally so never need to ping
sendgrid for them. I store with the x-message-id so i can map back to the
message
On Tue, Aug 13, 2019 at 11:50 PM alius notifications@github.com wrote:
@thinkingserious https://github.com/thinkingserious
Hello,
is there a way to map X-MESSAGE-ID from POST mail/send with GET /messages
query=msg_id="MESSAGE ID FROM X-MESSAGE-ID" ? why this does not work?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/sendgrid/sendgrid-csharp/issues/274?email_source=notifications&email_token=ADEVM2USDZ4F3B4L5EEWGKLQEOTKNA5CNFSM4CJQKBG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4H3RTY#issuecomment-521124047,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADEVM2WZ7NEW4XLWTNFPHTTQEOTKNANCNFSM4CJQKBGQ
.
--
Malcolm I Monroe BSMET, MSEE
Software Engineer & Consultant
Email: malcolmian.[email protected]
Phone: +1 (650) 483-4540
Is there any way to get "msg_id" as "xbYFDDtlQU-Q2IoogL9oQQ.filter0126p3las1-11204-5D95F127-4B.1" instead of x-message-id as 'xbYFDDtlQU-Q2IoogL9oQQ'
with response header in var response = await client.SendEmailAsync(msg)
It is really help full when integrating SendGrid API.
I'd like the same thing. Or at least the possibility to advance search Activity (in the GUI) using x-message-id. That only takeds Message ID now.
@gabrielkrell , Our IT team requires SendGrid IP so they can whitelist them. Could you please provide IP address?
@maulik-modi Please open a support ticket as this looks unrelated to this issue.
Most helpful comment
I'd like the same thing. Or at least the possibility to advance search Activity (in the GUI) using x-message-id. That only takeds Message ID now.