Is there any Key or name field (in Message.Header or else) SAME or RELATE for both received and sent mail? - email

Is there any Key or name field (in Message.Header or else) SAME or RELATE for both received and sent mail .
For example, MessageId is unique key for each message. But I want something else (Key).
I had not found any field in Message.Header(Message or MimeMessage or with also MimeMessageHelper)
I am using Java.Mail and I want to group each received and reply mail with a key.
Anybody help me, Please ?

In a word.
No.
There is nothing in the headers to tie one email to another. The closest you can do, is compare subjects + the Date.

Related

How to Add Followers Into The Recipient Field of an Email in Odoo?

I'm currently using Odoo 12.0+e-20181025 and I'm trying to add the followers of each ticket made in helpdesk into an automated email whenever it has been changed (not only in stage). So far I've tried some codes and managed to put the followers' emails into the body of the text, but in the recipient field.
Here is the code I used:
% for follower in object.message_follower_ids:${follower.email_formatted}%endfor
I can use it in the body text but I can't produce any result in the Email To field. Any help is greatly appreciated.
You could use ${str(object.message_partner_ids.ids).replace('[', '').replace(']', '')} in "To (Partners)" field.

MessageSummaryItems.Id vs MessageSummaryItems.Envelope.MessageId vs MessageId.GMailMessageId vs MessageSummaryItems.UniqueId

I am using MailKit to retrive emails from a Gmail account. However, I have been confused about the Id of an email.
I already looked at the documentation but could not find a complete explanation.
For example, I noticed UniqueId, is actually not unique; I mean if I move an email to a particular folder and fetch that email it has an Id (say 1). Then if I remove that email from the folder and add it again to the folder it gets andother UniqueId (e.g., 2)!
When I try to get MessageSummaryItems.Id the value for my emails are null.
The value for MessageSummaryItems.GMailMessageId is a big number that I don't know if it is realy uniquely assigned to that email.
The value for MessageSummaryItems.Envelope.MessageId seems a globally unique Id for that email.
I want more explanation about these Ids?
GMail does not support the OBJECTID extension, so MessageSummaryItems.Id will never get anything (e.g. the returned IMessageSummary.Id will always be null).
MessageSummaryItems.Envelope.MessageId is the Message-Id header value.
MessageSummaryItems.GMailMessageId is a GMail-specific identifier that is similar to the UniqueId but is globally unique for your account.
A UniqueId is a unique identifier, but is folder-specific. In other words, a message with a UniqueId of 5 in your INBOX folder will be different from the message with a UniqueId of 5 in your Starred folder, for example.
However, on GMail, a message in your INBOX with a GMailMessageId of 5 will be identical to a message in your Starred folder with the same GMailMessageId. They will both refer to the exact same message.
To understand why this is, GMail really only has 1 folder (All Mail) where all of your messages are located. All of your other folders, including INBOX, Drafts, Sent, etc. are just virtual views of the All Mail folder that filter out all messages that do not have the corresponding GMail Label.
That's why if you add a label to a group of messages, they will show up in your INBOX and in a new folder that gets created that matches the name of the label that you just created.

Generate email once order is changed to filled in netsuite

Once someone clicks on the fulfill button on the Sales Order I want it to send an email to someone.How can make this occur in Netsuite?
You can create a custom workflow on sales order and configure the worflow to send email to the specific email id. The email id can be either custom one / a field value from the sales order record (ex. customer, salesperson etc.,)
The condition for the workflow will be
OldRecord.Status!="Pending Fulfillment" && NewRecord.Status!="Pending Fulfillment"
Thanks
Frederick D
you can write a user event on Item Fulfillment record type and send email using nlapiSendEmail()
You may want to put a check in script if type == 'create' to avoid sending email on other record operation.

Correct REST endpoint design when dealing with messaging

I'm struggling to work out the correct REST endpoints for a certain situation. On my website it's possible for users to send messages to each other. One user is able to send messages to multiple recipients.
I think that /v1/users/123/messages would return all messages that have been sent to user 123
What end point should I use for messages that user 123 has sent?
My database structure is as follows...
accounts table
id INT
username VARCHAR(64)
messages table
id INT
account_id INT <!-- This is the senders account ID
subject VARCHAR(128)
message TEXT
messagerecipients table
id INT
message_id INT
account_id INT <!-- This is the recipients account ID
The messages table defines a one-to-one relationship between a message and its sender
The messagerecipients table defines a many-to-many relationship between messages and their recipients
Also I'm reading through a PDF on API design at the moment which seems to suggest I should hide this kind of complexity behind the query string.
For instance....
/v1/emails?filter=author_id(123)
/v1/emails?filter=recipient_id(123)
Thoughts?
I would expect
/v1/users/123/messages
to return all the messages that belongs to this user. This means received, sent, deleted, tagged, drafted etc.
To specify a subset of a resource you can go two ways with this like you and bertvh stated:
Querystring:
I find it perfectly valid for filtering as e.g.
/v1/users/123/messages?type=received&folder=important
Or as a subresource:
Use this if you expect to have a lot of filter options on a higher level e.g.
/v1/users/123/messages/received?folder=important
As you can see this would reduce a filter option.
And like bertvh stated, the underlying database schema is irrelevant for serving the responses.
I would do something like this.
To get all messages sent by a user:
/v1/users/123/sent
To get all messages received by a user:
/v1/users/123/inbox
Your database structure is irrelevant for the resource scheme but it can influence the payload structure. If you want to use JSON a message could look something like this:
{
sender: 123,
receivers: [124, 125]
content: "My message content"
}

Create Email with a workflow in MS Dynamics Crm 2011 and dynamically fill the "To" field

I'm working on Ms Dynamics Crm 2011 development and I encountered following problem.
My situation:
I want to be able to automatically send an Email after a change on a specific status field on a record of the Entity "MyEntity". "MyEntity" has an Email-field. I try to create a workflow which sends an Email to the Email-field address of the "MyEntity" record after the status has been changed. My problem is that I can't add in the Email Creation workflow to the "To" field this "MyEntity" Email-field adress. I need to somehow specify in the workflow to dynamically add the "To" field, the relating Email address from the specific "MyEntity". Is that possible? Is there a workaround for that? It could be done with a plugin I guess, but by now I'm trying to avoid the plugin solution.
Thanks in advance
John
Yes, you should be able to. First go to Solutions, bring up your entity, go to Fields, bring up your e-mail field and ensure the Format is e-mail. Publish.
Work around: If you have more than 1 e-mail Format text field, change the others temporarily (to text from e-mail) and Publish. Otherwise, the next step is ambiguous and we don't have control over which field CRM sets up as the email to use when this entity is used for e-mail.
In the solution frame, select your entity node in the tree. Under Communication and Collaboration, check the box 'Sending e-mail (If an e-mail field does not exist, one will be created).' Save/Publish.
Fix the work around above if you had more than 1 e-mail format text field. Change them back to e-mail. Publish.
In Workflow, select your To Field. Under the Send e-mail step, select 'Set Properties.' Select the 'To' field. In the form assistant you should not be able to select your entity. NOTE: You will bind to the 'Key' field and NOT to the particular e-mail field.
This only works for a single e-mail field on your custom entity. There is no way to use a text field as an address in a CRM 'to' field.
Unfortunately you cannot.
Out of the box the To field in an email accepts only
Account
Contact
Facility/Equipment
Lead
Queue
User
So in order to achieve the goal , you will have to write a custom workflow activity (optional : taking the custom text field in your input parameter )and refer it in your workflow or develop a plug-in.
Sample code for Plugin:
SendEmailRequest req = new SendEmailRequest();
req.EmailId = emailId;//ID of created mail
req.TrackingToken = "";
req.IssueSend = true;
For more information check this post Crm 2011 :Workflow - Sending email problem