Get MessageID of a sent mail in Outlook - email

I'm currently writing on an Outlook VSTO AddIn. Using this AddIn, I would like to keep track of E-Mail conversations and be able to uniquely identify mail messages. We are using Exchange as MTA.
For all the mails in the Inbox (and many other folders) I can use the Message ID from the mail's header to do the matching, but mails lying in the "Sent Items" folder do not have a Message ID set.
Is there a way to get the Message IDs from those mails?
(I guess that the mails do not have a header, as they are placed in the folder before being sent; but after sending the mail, the MTA gives a message with status code 250 which contains the Message ID.) Does Outlook know about or somehow save the MessageID? How can Outlook keep track of conversations, if it doesn't know the MessageID?
Is there another way to identify a mail?

First let us clarify why do you mean by
Is there another way to identify a mail
Actually you can duplicate an email then, they will have the same MessageID but different ItemId. If you have multiple recipients: toms#gmail.com, toms#an.exchange.mailbox.com, toms2#an.exchange.mailbox.com they will have the same MessageID (aka InternetMessageId) even the first one is not even Exchange. For the two others, there are two different messages within the same Exchange server. The have differents ItemID(aka EntryId).
Conclusion, the MessageID identifies the mail from its content and is set by the mailserver sending the email. To my knowledge there is no alternative (except creating your own "digest") from the immutable properties of an email. Keep also in mind that 'ItemId' changes when you move an email from a folder to another. See
For a VSTO add-in you can retrieve the MessageID aka InternetMessageId using Redemption.
The other alternative is to ask the ExchangeServer using MAPI or EWS.
In all cases there will be a 'server call' and it cannot be retrieve directly after sending because this property is set by Exchange Mail server.

Related

Email open tracking

I have to create email tracking system, but the problem is that when the sender opens an email this is counted as an opening by the recipient.
When I send an email through Polymail (or some other tools for tracking emails), then in the 'sent' folder I have an email without a tracking pixel, but the recipients of this email have the pixel and at the same time everyone have different code inside (I think, to determine which of the recipients opened the email).
How is this possible? The sender and the recipients have different contents of the same email. Can this be implemented using smtp / imap / gmail-api?
For standard IMAP/SMTP setups (specifically: not GMail), the message is submitted twice, once to SMTP to be sent, and again to IMAP to be placed in the Sent mailbox.
There is no requirement that these be the same: in fact, in normal use, the BCC header, for example, is submitted to IMAP, but not SMTP.
GMail, and a few others, while trying to be helpful and save bandwidth, do the copy automatically, but make it impossible to supply different versions. (Unless you want to try to find the duplicates and delete them out of band).
Current Email protocols don't send any kind of ACK to the Sender when mail is opened. So you need to put some kind of analytic tool inside the mail contents to keep the track of it.
Some suggested methods and widely used tool is Bananatag.
Alternatively, you can use custom Google Analytics for the same. Refer here https://dyn.com/blog/tracking-email-opens-via-google-analytics/

How to display all recipients in an email

I am currently using SMTP in a .net application to send files automatically when the user prompts the system
We have recipients setup to receive certian SSRS files, some clients want all and some clients only want one report. As such, the user just hits send and we send each client a single email with their requirements.
The issue is that since we have added this flexibility the clients have lost who is receiving the file.
Is there anyway to list all the receipients of an email in the to section or am I going to have to move all the recipients to the body of the email?

Stop internal read receipts (Outlook 2013)

User wants to send read receipts with all external emails. I've set up a mailbox rule in Outlook to do the following:
Apply this rule after I send the message
notify me when it is read
except if sent to *Bristol* //Dynamic group for office contacts
or except with #"domainname" in the recipient's address
To stop read receipts on internal emails I've set a rule with ECP via "Mail Flow" > Rules to:
IF
the message type is *Read receipt*
AND
The sender is located *Inside the organization*
AND
The recipient is located *Inside the organization*
THEN
Delete the message without notifying anyone
However it is still requesting read receipts for internal contacts.
Outlook and Exchange 2013
Your rule will only stop the delivery of read recipients not the prompting for which is controlled by a property within the message itself.
You could write a Transport Agent https://msdn.microsoft.com/en-us/library/office/dd877026(v=exchg.150).aspx that could do this by basically processing every message that passes through the Hub (or hubs servers) using the TNEF parser find the PidTagReadReceiptRequested and set it false for those Internal recipients. Probalby the best sample for this type of thing would be http://blogs.msdn.com/b/mstehle/archive/2009/01/13/howto-sample-transport-agent-add-headers-categories-mapi-props-even-uses-a-fork.aspx .
The other way that may work is to Setup a Rule Programatically that using the tagAction http://www.dimastr.com/redemption/rdoruleaction.htm#RDORuleActionTag . In theory you should be able to modify a MAPI Property with this action but there are complexities around this and I've never use it.
Cheers
Glen

Restrict email recipients based on email keyword in MS Outlook 2010

I work in a medical study where study coordinators at several off-site locations will be sending sensitive data via email attachments. These emails will be encrypted, but I cannot have the emails going to anyone but one or two specific recipients. I need a method to restrict who can receive email attachments based on a keyword in the email subject line. We are using MS Outlook 2010.
Ideally, it'd work this way: If the sender's email's subject line includes a keyword like 'RestrictedEmail' then only designated email recipients (for example, king#kong.com or robin#hood.com) can receive the email, else, the email will not send.
I didn't see this elsewhere in archives. Maybe I'm not using the right keywords...
Thanks in advance!
Trap the Application.ItemSend event, look at the message subject (Mail.Subject). If the match is found, loop through the MailItem.Recipients collection and check each Recipient.Address property to make sure only approved addresses are present.

Custom mailing list system

On our website we use a MySQL table which contains all users. Some of the users should be able to send mails to all users. Unfortunately I haven't got the right idea how to implement such a system.
My current design:
A privileged user writes a mail to users#website.com using his personal mail software.
A server is waiting for incoming mails.
As soon as it receives a mail, it matches the 'From' field with the database.
If the user is not found or hasn't got the special flag, discard the mail.
Forward the mail to all users (mail addresses are saved in the database)
Send the sender a confirmation mail.
How can I implement such a system? I'm not required to stick to a certain programming language even though C++, PHP or Node.JS would be preferred.
As a jumping off point, look into IMAP/SMTP. You can, with any language, log into an email inbox, get emails, read them, etc etc etc. Set up your mailbox with an account users#website.com that receives legitimate emails. Then set up a cron job that checks the inbox every 5 minutes or so. If no emails are found, then you are done. If there is an email there, process it, run your checks against your DB, and then send it using SMTP, and then send the confirmation to the user.
If handling IMAP is too hard, you may just want to make a form on your website that privileged users can use which sends the emails to the users.