Identify bounced EmailMessage (EWS) - exchange-server

Is there a way to accurately identity bounced back email notifications in a mailbox using EWS? So far I`ve looked at the message headers and nothing seems to indicate that the message is an email bounce notification.
I also looked at the Item and the EmailMessage members and haven't found anything useful (I may have missed something).
I could always parse the sender which always says 'Email Delivery System' or the subject line or even the message body, but I'm looking for a cleaner way to do that.

Try the ItemClass property.
This corresponds to PR_MESSAGE_CLASS MAPI property. This link provides some values for this property. You can find there a list of message classes for different types of messages. Some of them are for Non-Delivery reports, which I think is what you want.
It seems that if this property value starts with "REPORT.IPM" and ends with ".NDR" then its a Non-delivery report.

Related

Get message event_id from reaction_added in slack api

Using the slack_sdk in python, I am attempting to store who reacts to a message sent by the bot, and what what specific message they reacted to. The payload I get from a reaction_added lets me know who sent the message someone reacted to, but not the specific message event_id. Is there some way where I can tell what message someone reacted to?
the Payload received does not seem to carry the data I need. I checked the api docs, but couldn't find how to get more information on the event_id of a message someone reacted to.
The Event IDs for each event are only so useful for correlating activities between events. You won't really find a way to link the actual event describing "what happened" with another event.
However, you can correlate what the events reference together. In reaction_added you receive a bundle of data in item describing what the item_user reacted to. When it's a message, type will be set to message, channel will indicate the ID of the channel where the message belongs and the ts value will point to a specific message ID in that channel.
If you previously received (& persisted) the message that has been reacted to, you'll need to correlate that with the ts and channel values you'll also find in each message.
If you don't have that message and need more data about it and have the appropriate permission scopes, you can use the Web API method conversations.history to fetch a single message as documented here.

IBMMQ, under what scenario will MQMD.MsgType=1 be interpreted as MQMT_SYSTEM_FIRST instead of MQMT_REQUEST

We are using JmsTemplate to send messages to an IBM MQ's local queue. We set MQMD property MsgType to 1, but when viewing the message header from the queue, the value is interpreted as MQMT_SYSTEM_FIRST instead of MQMT_REQUEST. Why is that? Is this the reason why the other party's system cannot return the reply message?
We are doing debugging with another system. According to their feedback, they checked our message header in the queue like this.
enter image description here
But based on past experience, our message should look like this (Please focus only on the MsgType field).
enter image description here
And there is no clue as to why these two different situations occur. Their values are both 1, but MQMT_SYSTEM_FIRST and MQMT_REQUEST are displayed respectively.
I suspect this is just a flaw in whatever you use to view the header in that it does not realize MQMT_SYSTEM_FIRST is never 'set', it is just a range identifier.
What are you using to view the header?
This question is really a duplicate of IBM MQMD header how to distinguish

MS Outlook Add-In: During "Compose Message" how does one separate previous conversation from newly composed?

I'm setting up a MS Outlook Add-In that performs some analysis on newly composed messages. To read the message body, I use the Office.context.mailbox.item.body.getAsync() function that's part of the outlook JS API. If the user is composing a message that's part of a conversation, i.e. when replying or forwarding, this will also yield messages that are part of that conversation. I want to remove previous messages from the returned body, since they are not relevant for the analysis. What is the best way to do this?
What I've come up with is a regex that matches common Conversation headers, specifically "From: ..... abc#def.gh" or similar.
The specific Regex I used:
/((From|Von|De|Desde).+)[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*#(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.+/g
I am aware that this will yield many false positives, so I am looking for a better way to accomplish this.

Mailchimp - how can I tell if a user has unsubscribed themselves?

So they've clicked the unsubscribe link in a newsletter. In their profile it says, for example:
This person unsubscribed on Mar 24, 2017 2:40 pm
After receiving "Newsletter Test#6"
Great, but how can I tell programmatically, via the API, if someone has unsubscribed themselves? Is it even possible? The reason I'm asking is because you can't delete someone who has unsubscribed themselves. If you try, their data will be scrubbed but the email address will stay in your list. Furthermore, if you try to subscribe someone who has unsubscribed by clicking on an unsubscribe link, you'll get "john#example.com is in a compliance state due to unsubscribe, bounce, or compliance review and cannot be subscribed." So in this situation we should check if they've unsubscribed themselves, and if so we can set their status to pending which will send the confirmation opt-in email. Otherwise, we can subscribe them via API without setting their status to pending and sending them an email and requiring them to click the link in the email.
As you've noted, if you try to delete someone in a compliance state, the API will reject your request but unfortunately doesn't return any useful response indicating as such. On the other hand, if you try to subscribe someone in a compliance state you should get a response in json form with status of 400 and a corresponding message. In my case it looks something like this:
{
"type":"http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/",
"title":"Member In Compliance State",
"status":400,
"detail":"johndoe#example.com is in a compliance state due to unsubscribe, bounce, or compliance review and cannot be subscribed.",
"instance":"1234567890abcdefg"
}
If you simply parse that response you can check for the value of status which is probably more reliable and forward compatible than the textual descriptors - and if applicable you can set member state to pending from there.
From Mailchimp support:
When a user is unsubscribed you'll see the parameter unsubscribe_reason and if it's an admin unsubscribe or an unsubscribe done via the API it will say "N/A (Unsubscribed by an admin)". However if it is done by the user it will often say "Unspecified" if they did not leave a reason or it may display a reason the user noted for unsubscribing. You can read more about the unsubscribe_reason parameter at the link below.
http://developer.mailchimp.com/documentation/mailchimp/reference/lists/members/
To expand on the answer from #nmit026, do a get-member-info api request and check for:
unsubscribe_reason == 'N/A (Unsubscribed by admin)'
In my opinion, this feels a bit hacky as the logic relies on comparison to a fairly specific string, but nonetheless, it is probably only correct approach at the moment.

Any way to tell what text message another message is in response to?

Are there any texting services out there (like Twilio) with APIs that allow you to see what message another message is in response to? For example: I want to tell whether message 3 is in response to 1 or 2.
A->B: Do you like ice cream?
A->B: Do you like pizza?
B->A: Yes.
I'm guessing that there's just no threadedness to text messages, and this is impossible. But might as well have a canonical answer out there.... Reasons for this belief:
When you send emails to a phone number at txt.att.net, it uses a different number each time.
The texting services that I've looked at don't offer the feature
The phone UIs I've used all present it as a flat message list rather than a threaded list
Can someone confirm this?
There is no native support for this type of functionality in SMS. Message threading for SMS is inferred on the client side from context. When I send a text to person 1, if I receive a reply from person 1 within a given time-frame, I can assume that it was part of the same "conversation". (I actually implemented something like this for a chat client that I was working on)
I have also seen where the original message is included with the response, and the client can group the messages accordingly (take a look at gmail), but this could be messy if your clients were not the same.
Just a few thoughts.

Resources