I am using outlook rest api to interact with my emails. I am storing my emails in a SQL database. The message response object has a filed called ID which according to the documentation is "The unique identifier of the message.". But I can see this id is same for multiple emails.
What is the exact behaviour of Id field??
You need to make sure you're comparing them in a case-sensitive manner. They do not repeat.
#ptwo There are two types of IDs, one of them is called 'ID', which is unique for every email, the other one is conversationID, which can be the same for the emails that are part of the same conversation (Reply, Reply All,...). You should not make ConversationID a primary key in your database table.
Related
I'm sending mass messages with custom messages per subscriber, when I get the bounce-back I use my own cocktail to read the STMP emails.
What I haven't figure it out is how to add a unique ID for each email that is sent out, so in my bounce-back I can read the email's code and look for that particular ID, currently when I read the bounce I look for the recipient email compare to what I have based on creation date plus the email...
Is not efficient and 20 emails out of 1K or so gets lost cuz I can't find in bounce the headers due to some servers custom messages although it does return headers but I have nothing to compared with...
So is there a way to add this UUID in Swift services? I have seen that Swift is adding its own UUID but I haven't been able to retrieve it, when the message is sent I want that UUID so that I can save it and then latter I can read it from the bounces...
So, if I can't retrieve it, can I add my own?
I wanna have a relation email and UUID that was use when that message was sent.
$message_out = (new \Swift_Message($out->subject))
->setFrom($out->from_email, $out->from_name)
->setTo($out->email)
->setBody($content, 'text/html')
->setReplyTo('noreply#foo.com', 'No reply');
$message_out->send($mensaje_mail, $errors_sent);
Is this a header I can add the retrieve it in the bounce-back messages?
Thank you.
From what I've read, every Message-ID must be unique, however it is possible to create repeated Message-IDs if we force the header with a fixed value. So I don't understand what the point of them saying that the Message-ID should be unique, but they are very easy to create duplicates. If they can easily be generated by anyone with a little reading and basic programmatic knowledge, why do Message-IDs exist and what are they used for, which I can easily duplicate?
Short answer: For threading in email clients.
The message-id header is defined in RFC 2822:
The "Message-ID:" field contains a single unique message identifier.
The "References:" and "In-Reply-To:" field each contain one or more
unique message identifiers
The message ID is used to show which message is a reply to which other message, for example. That way mail clients can show a tree of emails with their replies even if other things like the Subject don't change. (Counting leading Re:s of the subject line would be a bad way to determine ancestors and children: not every mail client adds them, and some use language specific ones.)
https://datatracker.ietf.org/doc/html/rfc5322#section-3.6.4
in conjunction with the References and In-Reply-To fields, mail clients use Message-ID to organize multiple messages into threads.
https://en.wikipedia.org/wiki/Message-ID
and at least some clients will consider two messages with the same ID to be the same thing and discard one of them.
I need to add a custom header to an email using the System.Net.Mail.MailMessage class and then using the Microsoft.Exchange.WebServices.Data.EmailMessage class I need to read that value.
What I'm trying to do exactly is bounce processing for emails we send out. I am generating a new Guid value and adding it to the headers right before it's sent. I'm storing that value in a database and need to match it up when a separate process scans the inbox for processing. I all of that working except one part - I can't get the message ID from the header.
I know messages have a Message-ID header (which is automatically added) and I can access that but what I'm having difficulty with is getting that value when it's sent in the first place. Is that even possible? If so I'll use that instead of my own value.
I can get the email address and the other relevant information but the system I've written uses the message ID I was assigning as the foreign key used in joins in the database.
Any guidance on this would be appreciated. I doubt I'm the only person whose ever tried doing this.
Sorry everyone, the email I was testing with didn't have the header in it, that's why it couldn't be found.
I created a new email with it added and I could access it through the InternetMessageHeaders property of the EmailMessage object.
I need to send some mails my users.
I will send it from console, so I have not any user's cookies.
And to track opening mails I insert img in letter body like this:
<img src="https://www.google-analytics.com/collect?v=1&tid={{UA}}&cid={{CID}}&uid={{UID}}..." alt="" />
How can I replace {{CID}} ?
Where should I find it?
Thanks
If you want this hit to be connected to an existing user from your website you would need to record the client id when a user signs up for your emails, maintain a database that maps the recorded id to the e-mail address and the actual substitution would depend on your mail script. Since in this case the clientid is created in your users browser the only possible source would be the cookie.
If you just want to record a hit (without connecting it to existing users) then, as DalmTo pointed out, just use a random unique id.
If you do not have a client id, but have a way to identify the user on your website then you could also try the UserId feature and session unification. In this case you would use a random client id and append your known user id as parameter.
You should refer to the measurement protocol documentation
Protocol Version v v=1 The protocol version. The value should be 1.
Tracking ID tid tid=UA-123456-1 The ID that distinguishes to which Google Analytics property to send data.
Client ID cid cid=xxxxx An ID unique to a particular user.
Hit Type t t=pageview The type of interaction collected for a particular user.
this may also help Email Tracking - Measurement Protocol
How can I replace {{CID}} ? Where should I find it?
It should be a unique number identifying this user, its basically used for session control. Random Guid works.
EWS Managed API have two properties:ConversaionId and ConversationIndex
What is the difference between them? I guess ConversationId is the the ConversationIndex of the first mail in the conversation which is essentially of 22 bytes, while ConversationIndex is the index of that particular reply in the conversation thread, essentially of 22 bytes + multiples of 5 bytes for each reply in the conversation. Is it like that?
Also ConversationId is accessible only with Exchange Server 2010 onwards. So cant we access ConversationId in the Exchange Server 2007?
Correct, you can't access ConversationId in Exchange 2007.
The ConversationId identifies the conversation. The ConversationIndex represents the message’s position relative to the original message. ConversationId is not the ConversationIndex of the first mail. Here are some sample values I just grabbed off a new message.
<t:ConversationId Id="AAQkADIwM2ZlM2ZlLWMwYjctNDg2Ny04MDU0LTVkMTFmM2IxY2ZjZQAQACkRMjewk3RHldv8l7aTV2s=/>
<t:ConversationIndex>AQHPkWCfKREyN7CTdEeV2/yXtpNXaw==</t:ConversationIndex>
<t:ConversationTopic>test message</t:ConversationTopic>
It should be noted that ConversationId does not appear to be unique per entirely different conversation threads.
Meaning, while you can be assured that two conversations that don't share the same ConversationId are definitely not related, the converse -- that the same ConversationId guarantees the same "email thread" -- as popularly understood (people answering each other in a chain) -- does not appear to be the case.
I have discovered multiple instances of the same ConversationId on the same email Subject (every now and then) even though the cascade is not off the original.
So for example if HR sends out a "Thought of the Day" email freshly each day to a given group X, this may have the same ConversationId even if they are new chains.
This is problematic if one is sorting emails on a website from payroll by, say, "RE: your 401k" and two distinct conversations are conflated.