Indy 10 and MsgId - delphi

I am trying to group emails sent and received by threads in my Delphi XE2 application. I use Indy 10 components and the idea is to link the email unique Message-IDs with the In-Reply-Tos.
First step is to store the Message-ID of the very first email of the thread sent out. This is the email that starts the thread.
Second step is to store, for the emails received, the email In-Reply-Tos field. By linking Message-ID and In-Reply-To I can compose the email thread.
The first step is achieved with the following code:
FIdMessage1.MsgId:='Unique ID';
FIdMessage1.ExtraHeaders.Values['Message-Id'] := FIdMessage1.MsgId;
Here the email is sent out with 'Unique ID' in the field Message-ID of the email correctly.
When the recipient of this email replies the In-Reply-Tos is not 'Unique ID' any longer but something like '<-9999999999999999999#unknownmsgid>'. It seems that the recipient email server override my Message-ID.
What can I do in order the server not override my Message-ID ?
If my approach is wrong what can I do in order to organize emails sent/received in threads ?
Organizing emails by subject is not an option because there may be different email threads with the same subject.
****UPDATE****
I have solved, temporary, this issue.
I delete the code I mention in the first step above then with this piece of code
Get email headers from GMail's "Sent items" folder
This way I can retrieve the email I have just sent and with AMsgList[i].MsgId I can see the email id.

Related

MSGraph - Getting external email conversation from reply

My team is building a ticketing system. The goal is when we receive a new email we create a new ticket. All responses to that email are saved on the same ticket.
We have these basic goals working in simple cases, however, there is one case that we are struggling to find a good solution for. A client will email us, which creates a ticket, and we reply back requiring information. The client will send our reply to someone internal to their company. Then they will send the response back to us by replying with "see below". This response will have the conversation between them and their co-worker in the comment section of the email. The comment section will also contain our entire email chain which we don't want to duplicate.
The issue we are having is grabbing the conversation they had from the comment section to include with their response of "see below" and add them to the ticket. The only method we have come up with to solve this is manually parsing the comment section of the email, however, this is error-prone.
Does anyone know of a better way of tracking conversations they send you through the email?
We are using msgraph internally to send and receive emails and using their apis they have uniqueBody and body, but they don't seem to have a way to break the body up into its different parts.
What I need any of these options
1- get list of unique bodies from the email chain without using conversation Id as it will not be sufficient in some cases.
2- get the previous conversation Id of the incoming email. I mean if that email is a list of emails and it forwards to me.
UUID uuid = UUID.randomUUID();
message.addProperty("InternetMessageId", String.format("%s",uuid.toString()));
send InternetMessageId with a unique identifier to grab conversation id
change order only

Send and receive email by Rails App

We have build custom crm app(rails 4.0). One of the features that we have build is that we send emails to our customers based on booking status or we send a custom email by our travel agents.
The next thing we want is that customers can replt on this email. So we can recognize the email thats replyed and related to the initial email is send, so we have a nice email dialog (send/receive) in the crm.
Someone ideas how we can "recognize" the replyed email so we can related it to the right email?
Thanks..remco
In your email client open a reply from someone and show full headers or raw source (how to get it depends on the client but you will find it!)
When you look at the email headers you will find References field
References: <CAAC3oDjZSFywS5mpAANO+svm-3xXwLciUhw_QEkBkNqT9A#mail.com>
<06AFEF94-53D2-4469-59B0A494830C#mail.de>
<E67E3945-D61E-8E45-63C52D111698#mail.net>
And more importantly
In-Reply-To: <6397034C-90CA-41B4-F47AE3F39E76#mail.de>
While every outgoing email has a Message-ID field
Message-ID: <569F22.8060202#mail.de>
To get an if of you outgoing message
result = SomeMailer.message(params).deliver
result.header['Message-ID'].value

Mandrill is ghosting accounts or am i incorrect - it says delivered however mandrill did not even tried to send emails

I am using free mandrill account and sending email via using template and API
When i send message it returns okay it is sent as status
However even after several days there is still no smtp events at mandrill interface and the email is not arrived
So i am 100% suree mandrill is ghosting accounts
Or there is something else that i do not know?
Thank you for answers
PS: At the beginning emails were arriving but after some point no smtp events and no emails ever arrived even though no error message parsed. Also when i send to non existing email no bounce message returned.
Also account reputation is 61 : excellent
Yes i believe mandrill certainly ghosting accounts
After trying with several accounts i am now sure of it
Even if you send to non existing gmail email, it says delivered in its interface
However it should have displayed hard bounced
So beware of their free service. I believe this is not an ethical way of working. People would think that their emails are arriving however they are ghosted and mandrill did not even try to send them and yet displays delivered
Have you check it on Mandrill account? It shows all the report at outbound tag. The reason is, a queued response in the Mandrill API is not the same as a queued response from a recipient server.
When you send a message through Mandrill, you first relay it to Mandrill, Mandrill processes it, and then Mandrill relays it to the recipient server. This all happens quite quickly, but the two relaying steps are separate and distinct. The KB article you've linked to is providing additional details on that last step, relaying to recipient servers, not a queued status for the Mandrill API.
There are a number of reasons the Mandrill API may respond with queued including if you've added attachments or if you're sending to a bunch of recipients in a single API call.
Without seeing the actual API call that's being made, it's hard to say why you're getting a queued response. But if you're using the sample messages/send API call, you'll want to remove all of the optional parameters that you're not actually setting. For example, the sample has fake attachments, and a subaccount specified. The attachment will cause the call to be processed async. The subaccount probably doesn't exist, and would then cause the call to fail. So if that's the case, try removing all of those optional params. If not, please provide the API call you're making with sensitive data redacted (API key, actual email addresses).

Why does IdSMTP.Send fail if only one email address is incorrect?

I'm using Indy and Delphi to send email messages. I've had no issues until one of the users was recently let go. Their email account was deleted and my program attempted to email about seven users including the "downsized" user. I expected the SMTP server to accept the email and deliver the message to the valid users and then send an email back to the Sender informing them that the one account in the recipients list is no longer valid.
Instead the SMTP server did not accept anything and no one received the message. I got "Mailbox Unavailable" in my log. Is there a setting to change this behavior on my end? Email clients like Outlook certainly do not behave this way.
Specifically, what is the proper technique to send messages so that all valid email addresses in the recipients lists get delivery, and the Sender is notified by the SMTP server of any incorrect addresses?
Thanks in advance.
If you are using Indy 10 then you need to assign a handler to the TIdSMTP.OnFailedRecipient event and have it set the VContinue parameter to True.
procedure TForm1.IdSMTP1FailedRecipient(Sender: TObject; const AAddress, ACode,
AText: string; var VContinue: Boolean);
begin
// do something...
VContinue := True;
end;
That will allow TIdSMTP to skip the failed recipient and keep sending the email to the remaining recipients. Only if all of the recipients fail will TIdSMTP then fail the send (unless some other non-recipient error occurs, of course).
If you are using Indy 9 or earlier, or do not provide an OnFailedRecipient handler, TIdSMTP will fail and abort the send on the first error encountered, including a recipient error.
The SMTP server will NOT send a notification to the sender's inbox if it actively rejects a given recipient while the email message was still in process of being given to the server by the sender. You will have to use the OnFailedRecipient event to act upon that recipient. Only recipients that are accepted by the server and then later found to be in error will then send a notification to the sender's inbox accordingly. That is simply how SMTP works.

Jenkins Extended Email Notification - Email Content as attachment

Using Jenkins 1.499 and version 2.25 of the Jenkins Email Extension Plugin. When emails get sent, the content of the email is showing up as an attachment to the notification and not in the body of the email. In fact, the body of the email is blank. Changing the content type of the email has no effect. We use Exchange/Outlook, could that be the issue? Any ideas to get the content of the email in the body of the message?
I think this may have to do with your junkmail settings, either in Exchange and/or in Outlook
For me, when I received the first Jenkins email in Outlook, I had to click on the warning lines (just above the email header) and select "Add sender to safe senders list"

Resources