Set Outlook category on mail using Java - java

I'm trying to set custom categories on an email item programmatically using Java.
I found this: Setting an Outlook mailitem's category programmatically?
but I would like to do the same thing in Java. I guess some custom headers are set on the message, but I can't find information on which headers I should set. Anyone got information on this?

JMSG is Java API to create and read Outlook message files. It provides methods to set/get categories as well as many other headers.

Related

Azure Function (Java) add attribute to CustomDimensions

I am desperatly searching on how to add a new attribute to the custom dimensions collection in the request table of the log analytics in the context of a Java function.
I know in C# you can do it using Activity and ITelementryInitializer but for Java I can not get it to work.
Any hints are appreciated. ;)
Azure Function (Java) add attribute to CustomDimensions
In Java, we have the Span attributes concept for adding the optional (extra) fields to the App Insights Schema that populates with the customDimensions in the form of various tables such as traces, exceptions, dependencies.
For that, one of the dependencies is required which is opentelemetry-api-1.jar.
AttributeKey newAttributeKey= AttributeKey.stringKey("resourcecustomDimension"); Span.current().setAttribute(newAttributeKey, "customDimValue");
This brings us the custom attributes for the custom dimensions that will be added to the Telemetry data.
Refer to this MS Doc for more information on adding the attributes to the customDimensions and found the GitHub issue 13310 regarding the user seeking for the Java Code on ITelemetryInitializer where the sample code on it provided by #dhaval24 user.

Programmatically set signatures in Outlook client using JAVA

I want to set signatures for multiple address in outlook client application. I read concepts using VBA and other scripts. But I want to do it in Java. I have already created the html signature files. I can use AD to pull user information but I don't know how to connect it with Outlook using Java. Can someone help me with this?
Thanks in advance.
Outlook Object Model does not expose signatures at all.
On the Outlook account level, the name of the signature is stored in the account profile data accessible through the IOlkAccountManager Extended MAPI interface. Since that interface is Extended MAPI, it can only be accessed using C++ or Delphi. You can see the interface and its data in OutlookSpy (I am its author) if you click the IOlkAccountManager button.:
If using Redemption is an option (I am also its author), you can use its RDOAccount object (accessible in any language, including Java). New message signature name is stored in the 0x0016001F property, reply signature is in 0x0017001F (can be read or set using RDOAccount.Fields[]).
You can also use the RDOAccount.ReplySignature and NewSignature properties.

How to get unique mail url (MID) Java Mail

I am trying to generate the similar layout for previous messages as this implemented in Thunderbird, Gmail, etc.
I have investigated their format and found the following code
<blockquote type="cite"
cite="mid:4424cab4-7955-de62-48b4-7d50116f0bbd#mail.com">
I wonder how this mid is generated ? And how can I get it using JavaMail.
Or maybe there is any other way to generate layout for previous messages?
It's a UUID (Universally Unique Identifier):
Here's an example of how to generate one using UUID.randomUUID:
String mid = UUID.randomUUID().toString();

Getting an error code 80 on textlocal

I am using TextLocal tool to send SMS in my java code. I am using the same code snippet given here.
This is a transactional account. I am getting the following error
{"errors":[{"code":80,"message":"Invalid template"}],"status":"failure"}
This error code is nowhere found in the TextLocal documentation. Please let me know the solution if anyone has faced this issue before.
This was happening because the TextLocal transactional messages should be given a message template through the TextLocal dashboard and all the SMS sent should follow all the rules of these messages.
After the template has been created and followed, the issue is resolved.
go to Your login dashboard of textlocal
Then in send menu go to template and draft.
then open your template to see the message format.
And provide same massage format to your java method to send message.
Hope may it help you.
Few quick points to check
1.Is the message that you are passing in your API as per your approved
templates? If not, this error will come in response to your API. You
can check your approved templates under Send -> Templates & Drafts
2.Are all special characters in your template (&, #, #...) URL
encoded?
3.Are you using the same placeholder name
for multiple dynamic/replaceable parameters in your API? They have
to be unique.
4.Are you exceeding the max character length set for
the placeholder? Are you using a newline character? Replace all the
newline characters with %n
The above points are from textlocal SMS API documentation. You can also try copying the content of approved textlocal template into the Java code.
This because of the sending message content doesn't match the template which you created on the textlocal account.
check template is created or not. If not create a template and try.
If created check current message content match with your existing template.
This is happening because,
From a transactional account you can send only those messages that
match one of your pre-approved templates. Please ensure that your
messages match one of the approved template formats.
To create a Template,
Go to Your login dashboard of textlocal-> Send -> Templates and Drafts.
Then create a Template. Templates can be 2 types Static & Dynamic. You can create both by using this. Template message format should match the format in your code.
I am providing a link.. This will help to understand this more clearly.
How to create and format template

How to download refrences part of emails using java?

I am trying to download the email using imap java ..I have downloaded most of the part of email but don't know how to download references part of email?Can someone provide help about which function is used to do that?any links to some page would be helpful.Thanks
References: <CALdDwZ=PQDu2eS1R2ONsrHJDgHDeZuNCUfEsfRqC3efzZfMaqg#mail.gmail.com>
<CAAD0KRhD7w1qdRiTG6U00ShroE1R00h7F73_AQ4yRnDE7jm6HA#mail.gmail.com>
<CALdDwZm2np83PmjrHY1jO54+6-dNKaM7+oxjaUHE_rUitMffrA#mail.gmail.com>
<CAAD0KRg2TJt0Y4oo-CsOCexrmat6kHakuFZSm_AvTDuSXjiTTw#mail.gmail.com>
<CAAD0KRhXUUwNjcAhc+4h-ftiJFW7q0y9gmDRGZ0khzyzWUDxbQ#mail.gmail.com>
<CAAD0KRgp6nhupkQhu2LWe6mXGuvK35XFdZLUUjfC4uGvsOZtcQ#mail.gmail.com>
<CAAD0KRhXaJ5FAuOxR760HBzgaD-_JyXoVAymeQf+nQdCawEgGA#mail.gmail.com>
These are message Id's of all the mails which took part in a conversation..Usually this is a part of an email.so I want to download it?
For downloading the References part of the email we need to use getHeader() function of Imap java ..This is the code :
if( msg.getHeader("References")!=null)
{
String[] headers = msg.getHeader("References");
System.out.println("headers");
for(int ab=0;ab<headers.length;ab++)
System.out.println(headers[ab]);
}
The references are Message-IDs. There's no way to directly access a message given the Message-ID. You can use the Folder.search method to search for messages with the given Message-ID in the specified folder, but there's no way to know what folder the message might have been moved to, nor is there any guarantee that the current user ever saw the referenced message.

Categories

Resources