ical4j Api, create new notification with OOF status - java

I am creating a new event calendar using ical4j plugin. I am using outlook to receive this notification.
This one must be show like an "absense" ( Out Of Office).
For this, i use property X-MICROSOFT-CDO-BUSYSTATUS = OOF.
When i receive this notification, in outlook, it looks like "busy" and not like "out of office".
Heres it content of .ics file
BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 14.0 MIMEDIR//EN
VERSION:2.0
METHOD:REQUEST
BEGIN:VEVENT
DTSTAMP:20140324T121412Z
DTSTART:20140804T000000
DTEND:20140805T000000
SUMMARY:absense
ATTENDEE;CN=Resp 1;RSVP=FALSE:mailto:toto.toto#test.com
SEQUENCE:0
CLASS:PUBLIC
STATUS:TENTATIVE
ORGANIZER;CN=res:mailto:etoto.toto#test.com
PRIORITY:5
TRANSP:OPAQUE
UID:123456789123456789aabbcc
X-MICROSOFT-CDO-BUSYSTATUS:OOF
X-MICROSOFT-CDO-IMPORTANCE:1
X-MS-OLK-CONFTYPE:0
X-MICROSOFT-DISALLOW-COUNTER:FALSE
X-MS-OLK-AUTOFILLLOCATION:TRUE
CREATED:20140324T121412Z
END:VEVENT
END:VCALENDAR
how can i do, to have the correct status of this notification in outlook ? is there something incorrect in my file ?
thank you

You mention receiving this REQUEST. If we translate this in iTIP workflow, we have etoto.toto#test.com (ORGANIZER) inviting toto.toto#test.com (ATTENDEE) to an event. So on the Outlook side (attendee side), you are receiving an invitation.
It would be weird if any arbitrary organizer could set your freebusy status to Out of Office, don't you think.
In other words, I think it make sense for Outlook to ignore the X-MICROSOFT-CDO-BUSYSTATUS.
On the other hand, if you remove the METHOD, ORGANIZER and ATTENDEE properties, and if you import the event, you may see the OOF value being taken into account (have not tried it myself).

Related

send email to generic ID in lotus notes using notesFactory in java

Their is a requirement in a project to send emails from java application through lotus notes.
Note: the domino server is installed on client server.
Currently i am able to send email using notesFactory on my local machine.using notes.jar file
Which accesses the user by .nsf by its password.
I.e creating secure connection by password.
And gtting database object by calling
Session.getdatabase(null,"user.nsf")
Its perfectly working.
But for some types of emails the client have shared a generic id...(link) over an email... By clicking on that link the generic mail box opens under active user. In separate tab... Through which we can send emails.
But have not shared their .nsf path or id or password.
It directly opens by clicking on that link.
Now i want to access that generic id in notesfactory session
I tried to keep open that id and then running my code...but still it sends email through active user itself.
And client is not ready to share the id and password details of that user. Not the id file is getting generated in our local machine.
Is their any way to send emails through that id?
If anyone want code i am using..ill share.
But for some types of emails the client have shared a generic
id...(link) over an email... By clicking on that link the generic mail
box opens under active user. In separate tab... Through which we can
send emails.
That does not sound like a "shared id", it sounds more like a mail database with the ACL set to give a group of users access.
When you send an email from within Notes (no matter if it is through the UI or through code), the actual logged in user is used as the sender. It is intentionally by design, to prevent users from spoofing the sender.
There is an unsupported way to fake the sender address, by dropping the email directly into mail.box, but that should only be done by someone know what they are doing.
I wrote a script library several years ago, intended to help sending emails. It includes the ability to set the sender address. You can find it on my blog, it's free to use. But I would not recommend you using it without first understanding what the code is doing.
Here is the relevant part of the code:
Set mailbox = New NotesDatabase(mailservername,"mail.box")
If mailbox.Isopen = False Then
Print "mail.box on " & mailservername & " could not be opened"
Exit Sub
End If
Set me.maildoc = New NotesDocument(mailbox)
Call me.maildoc.ReplaceItemValue("Form","Memo")
Set me.body = New NotesRichTextItem(maildoc,"Body")
Call maildoc.ReplaceItemValue("Principal", me.p_principal)
' If principal is set, we want to fix so mail looks like
' it is coming from that address, need to set these fields
Call maildoc.ReplaceItemValue("From", me.p_principal)
Call maildoc.ReplaceItemValue("Sender", me.p_principal)
Call maildoc.ReplaceItemValue("ReplyTo", me.p_principal)
Call maildoc.ReplaceItemValue("SMTPOriginator", me.p_principal)
Call maildoc.ReplaceItemValue("PostedDate",Now())
If me.p_principal<>"" Then
Call maildoc.Save(True,False) ' Save in mail.box
Else
Call maildoc.Send(True) ' Send mail normally
End If
You use the Principal field to set the sender address.

send message from android telegram source to to specific user id

I want to know, how can i send a message (for ex: text) from owner client to some body's id with coding(dynamically)in android telegram source?
what is that method?and objects?
if i want explain more i mean send message (to specific user id )from one of telegram source classes.
here is telegram source GitHub take look on it(the bad point is, it haven't any comment)
these classes may help to find it, but i cant figure it out
MessageObject.java
TLRPC.Message.java
ChatAttachAlert.java
SendMessagesHelper.java
ChatActivity.java
thanks.
you should use something like this method: SendMessagesHelper.getInstance().sendMessage(). note that it's a network call and you should call it in a thread other than ui thread.
simplest way to send a message is like calling:
SendMessagesHelper.getInstance().sendMessage("Hi there", to_user_id, null, null, false, null, null, null);
There are different types of messages and different ways to use this function. if you want to find out how to send other types of messages, search the java codes directory for "sendmessageshelper" and find how the sendMessage function is used in them.

Gmail watch user inbox, history.getMessagesAdded is not returning the new message

Requirement is to sync mails from Gmail for an user into our CRM. The system in place is based on Google Pub/Sub which watches inbox of the user for any change and fires the notification to our HTTPs endpoint. More on this at Gmail cloud pub/sub.
Based on the above procedure we git history of changes. And then i am interested in only new messages, so history.getMessagesAdded is preferred as per this guide. Issue we are facing now is the first mail of a thread is not captured under messagesAdded all the subsequent messages are passing through our system.
Note: For the first mail, we do get push from Google. But when we try to get Messages added it turns out empty. Is there anything special needs to be done for the first mail of the thread or am i missing out something.
I was experiencing a very similar problem, and my mistake was that I was using the historyId from the push notification, the solution was to store the last known historyId on my database, so, every time I get a notification, I get the history from the id I have stored, not the one from the notification.
In my case, the historyId from the notification doesn't even make part of the history, maybe because of my watch restrictions: labelIds=['INBOX']
This is the google pub/sub notification:
{
message:
{
data: {"emailAddress": "user#example.com", "historyId": "9876543210"},
message_id: "1234567890",
}
subscription: "projects/myproject/subscriptions/mysubscription"
}
I was using the message.data.historyId, wich was causing the confusion!
The message.data, comes as a base64 encoded string, in this example I just decoded it!
Step by step for watching new e-mails on the inbox:
Do all the configuration in the google pub/sub.
Start watching the user with the filters you want (docs.: https://developers.google.com/gmail/api/v1/reference/users/watch)
Store the historyId obtained in the step 2
When receive the notification, get all the events (history) using the stored id as the startHistoryId parameter (docs: https://developers.google.com/gmail/api/v1/reference/users/history/list)
In the history list obtained on the step 4, look for the new messages: history.getMessagesAdded().
Update the last known history id in your database, so you don't need to deal with the whole history every time!
I hope it helps.

Spring IAMP Mail receiver not reading all emails everytime [duplicate]

I have a piece of code which uses spring integration's IMAP adapter to poll an inbox to read all incoming emails which are unread and that works perfectly. But if I open any email message and and then mark it as "unread" in my outlook inbox the poller doesn't fetch the marked email.
I can use the pop3 adapter which fetches all the email, but deletes them afterwords, but I want to keep the emails in my inbox and I want the poller to fetch all the email which are unseen.
Any suggestions to handle this problem? I been searching and reading articles on email adapters but didn't find anything useful.
Thanks in advance.
Looks like you need custom 'search-term-strategy'. From Spring Integration (SI) documentation:
By default, the ImapMailReceiver will search for Messages based on the default SearchTerm which is All mails that are RECENT (if supported), that are NOT ANSWERED, that are NOT DELETED, that are NOT SEEN and have not been processed by this mail receiver (enabled by the use of the custom USER flag or simply NOT FLAGGED if not supported). Since version 2.2, the SearchTerm used by the ImapMailReceiver is fully configurable via the SearchTermStrategy which you can inject via the search-term-strategy attribute. SearchTermStrategy is a simple strategy interface with a single method that allows you to create an instance of the SearchTerm that will be used by the ImapMailReceiver.
And here is a post from SI forum with funtastic Oleg's explanation: Server does not support RECENT or USER flags
And here you can find SI DefaultSearchTermStrategy: it's a place to determine how you should implement your own strategy. I guess, you case is:
This email server does not support RECENT flag, but it does support USER flags which will be used to prevent duplicates during email fetch.
Switch SI-mail logging level to DEBUG and take a look, which flag supports your email server.

How to handle Delivery Status Notification of GMail

Does gmail support RFC1892(Delivery Status Notification) ?
If so, how can I use JavaMail to parse the DSN. (Sample code is highly appreciated)
If not, When a email can't be delivered through gmail, a failure message is returned. How can I detect these "bounced" messages?
1 - I don't know.
2 - Add dsn.jar from JavaMail to your classpath. Then use something like this:
if (msg.isMimeType("multipart/report")) {
MultipartReport r = (MultipartReport)msg.getContent();
// see com.sun.mail.dsn package javadocs for MutlipartReport
}
3 - http://www.oracle.com/technetwork/java/javamail/faq/index.html#bounce
Related to this question.
The X-Failed-Recipients header seems to be the quickest way to identify gmail DSN. After that, it seems you must parse the text/plain content.
The subject seems to be Delivery Status Notification (*status*) where statuses that I've seen are: Failure, Delay.

Categories

Resources