My goal is to read emails(and possibly mark them as read in the inbox) through Mirth Connect channels. I found this Reading mail from open source Mirthconnect question about the issue. Oddly the person asking answered the question. When I tried to implement the code he provided with my specifications such as instead of gmail outlook inbox(no problems here) the channel called out error:
64DETAILS:
TypeError: Cannot find function getBodyPart in object <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Hi!</div>...(here the email continues with div tags)
So I clearly get the email data but getBodyPart breaks it. What I understood from this is that his code was meant for specific kind of emails and I guess I received an non-mime email in the example here.
So it seems what I am asking: How do I create a reader that translates all mail into plain text and then output it into the logger/other output so I can manage it?
Management would mean something like spreading specifically titled mail into different channels and mark them read in the inbox they came from.
I hope I'm clear enough with my question and follow the rules of asking questions.
I am answering to your updated query.This program will be reading the email repeatedly as you mentioned is correct so as to avoid this after reading you need to move the email to other folder and also you can customise your program to read from particular email sender or based on subject so that it reads only your particular email and you can move that email to you wished folder.
I was the one whom you mentioned in the code. When I tried to fetch the mail from GMAIL also I faced the same issue. But I checked the security apps OFF, I have provided the link here for GMAIL. I guess something like this must be available for outlook as well. But I have tried the same code to read in my outlook it worked fine without any changes been made (not sure how?).
For GMAIL Security OFF
https://myaccount.google.com/lesssecureapps
It depends on the kind of mail your are reading. In my case I was getting HTML designed data in the body of the mail.That code was not generalized one. It is supposed to read HTML data in mail body.I'm not sure how your mail is?. But mp.getBodyPart(0) or mp.getBodyPart(1) should provide some output. Even if you attach the file in the mail, mp.getBodyPart will read the attachment.
Related
Aikau example contains a var button which configured to show popup with form control. As I know every aikau form has a value, which can be used to prepopulate controls, but how to load value from URL?
E.g. someone push on the button, it load "somehow" data from URL, stores them into Form value and then populate one field on the form.
The key problem is what parameters to use as URL (is it publishPayload.url?) and what and where a topic should be set for this?
I have tried already example modification and try to add publishPayload.url and setValueTopic: ALF_CREATE_FORM_DIALOG_REQUEST, but do not see any HTTP requests with URL. If URL was wrong I can see requests with 500 or 404 codes, but even these requests are not send.
Could somebody provide an example how to do this?
Note
It can be just a piece of code for button and cell with value. What is the data or url it does not matter, URL can be a simple link to some NodeRef with title/name property.
As with your last question I would suggest that you work through the Aikau tutorial on GitHub (see https://github.com/Alfresco/Aikau/blob/develop/tutorial/chapters/About.md) I think that you'll find that it has a lot more useful information on Aikau than the official documentation - those examples are taken from old blog posts that were written before Aikau became a standalone project in GitHub. The examples you're looking at a very much out of date and I will try to get them removed from the official documentation.
Aikau works on a publication/subscription model. A button will be configured with a publishTopic and a publishPayload. When clicked the payload will be published on that topic. Services can be provided to subscribe to published topics and provide data.
There are lots of examples of this in both the tutorial previously referenced and in my blog posts on the Alfresco Community platform
Posting question in StackExchange for first time. Apologies if this has issues...
Need to track email open.
This is something not very new and the approach generally used is to have a pixel in the HTML which calls a server URL asynchronously. By using this we get the number of opens for an email.
Now the issue is the email is send to a Distribution List (DL) and we have a requirement to track email open and also clearly state who has opened it..
Basically when a hit to server comes, it should says xxxx#mail.com has opened this email.
In my HTML if i have a way by whcih to capture the email headers, my requirement would be sorted... I would use Javascript to get the email headers and then when i call the server URL i will send across the details...
When i searched i found a POST which was doing something similar...
Read email headers in Outlook Web Access (OWA)
But this was for office application...
Also, i am not sure whether this would even work...
Any pointers is well appreciated....
I am specifically at the moment looking for exchange server...
In my HTML if i have a way by whcih to capture the email headers
You don't.
I would use Javascript to get the email headers
You can't run JavaScript in an HTML formatted email
The only identifying information you can get back from the email is the information you put it in it in the first place.
You can put a unique ID in a tracking pixel (increasing the chances of it being marked as spam) but that ID will be given to anyone who gets a copy of the email (including if it is forwarded automatically by a mailing list or manually by a reader). The tracking will also fire only if the image is loaded from the server (plenty of people keep email image loading turned off).
There is no way to find out who your email actually ended up with.
As you will all know that there are black list and white list in Zimbra mail server that will block or allow a new coming email. But it's quite inconvenient by this way to block an email. So I want to make a plugin in Zimbra mail server to filter email into spam and non spam category based on a list.
But the problem i met here is i can't get the information about a new incoming email address, here is email address and header. I've read some tutorials about writing a Zimlet, but it's all about making an action to get those information.
Can you guys tell me how to get those Information?
Thanks in advance :-)
This isn't, what Zimlets are made for. Zimlets are extensions to the Web UI. Perhaps it's possible to write a server extension for that, though I don't know currently, if there's an extension class for that.
I would use a "milter" for that. A milter is a way of "hooking" into the mail delivery process.
For an example, have a look at my "disclaimr"-milter: https://github.com/dploeger/disclaimr
Inside the milter you would use the Zimbra SOAP-API to fetch objects from the Zimbra server (lists for example).
I'm a relative newbie when it comes to coding, especially javascript. I currently am trying to populate a table from a google spreadsheet, which will update when the spreadsheet is.
I followed this tutorial word for word (basically all you need to do is replace the key with your own to specify your spreadsheet, and make sure its both published and public, which I've done)
http://dataforradicals.com/the-absurdly-illustrated-guide-to-sortable-searchable-online-data-tables/
I just get a bad request 400 error referring to my spreadsheet. If I visit the spreadsheet generated directly I just get the words...
"Invalid query parameter value for sq."
https://spreadsheets.google.com/feeds/list/1UcfO9GHePQrcixZB_R9uVXr1vHVqVTDg7DdsOjpm-K0/od6/public/values?alt=json-in-script&sq=&callback=Tabletop.callbacks.tt140241226993949106
I can visit my spreadsheet with the link I was given when I published it here..
[maximum links reached but the structure is different]
As you can see the domain structure is different. I fear that "Tabletop to Datatables" is adding an outdated url to the start of that link but can't find where it actually applies it.
The only reason I would think thats not happening is because the example in the tutorial still works! And the link it refers to is the old style URL too
I'm baffled, please help if you can. All suggestions appreciated
The query string includes a parameter without a value, &sq=.
https://spreadsheets.google.com/feeds/list/1UcfO9GHePQrcixZB_R9uVXr1vHVqVTDg7DdsOjpm-K0/od6/public/values?alt=json-in-script&sq=&callback=Tabletop.callbacks.tt140241226993949106
^^^^
Try this, with that parameter completely removed...
https://spreadsheets.google.com/feeds/list/1UcfO9GHePQrcixZB_R9uVXr1vHVqVTDg7DdsOjpm-K0/od6/public/values?alt=json-in-script&callback=Tabletop.callbacks.tt140241226993949106
There is an updated version of this project. Any necessary updates are included here:
https://github.com/scottpham/tabletop-to-datatables
Try with the updated versions of all js libraries.
Check the link and remove the extra string after pub. That part of link is not necessary and may cause issues.
According to google:
The 400 Bad Request error is an HTTP status code that means that the request you sent to the website server, often something simple like a request to load a web page, was somehow incorrect or corrupted and the server couldn't understand it.
Good luck
I've got a site where users extend their product trial with a registration code. They click a link (with a key in the URL) from an email, get to this site and a lightbox appears with their registration code. I'm currently displaying the registration code with HTML and hiding it with CSS. Once I check to make sure the URL has the correct key with javascript, I display the registration code. However, this means anyone can just view source on the page and copy the registration code. Is there a way to encrypt the code so it doesn't appear in view source, and then decrypt it if the URL has the correct key? It's one code per product, not per user, so I don't have to do any server side authentication.
If the computer knows it, the user knows it.
You can play obfuscation games, all of which amount to making your Javascript hard to read. But a sufficiently determined user will find it anyway, and once they do, they can easily share it with their friends.
One code per user is the only way to fix this reliably.
I check to make sure the URL has the correct key with javascript
Don't check the key client-side, validate the key on the server.
This is the only way to ensure only valid users get the registration code.
Pseudo PHP example:
if( validateKey($_GET['key']) ) {
echo 'The Registration Code';
} else {
echo 'Error';
}
Client Side Code is inherently insecure. Consider anything you send to a client machine public to the world, and don't trust anything that comes from the client until you cleanse it. A sufficiently determined user will de-obfuscate your code, regardless how much effort you put into the initial obfuscation routine.
Another tip to help you instead to show the registration code in the site you can send back an email to the user with the registration code.
And as Nemo suggest, the right way is one code for user
Hope it help
As mentioned before the client side will not cover your security needs.
Better would be to have the page send a Ajax request to the server containing the key, you can then respond with the registration code.
Even better would be to directly validate the key on the first request, then decide to return an error page or the page with the registration info.
As others have replied, doing this validation server-side is both easier and more secure.
You can have an AJAX request posting the URL key to a php page, that in turn would reply with the correct registration code.
That being said, there is always the possibility of using a client-side use encryption library (like AES), but from what i understand i don't think it would be a good approach to solving your problem.
Again, doing it on the server-side is both extremely easy and as secure as you need.
Encrypt your registration code (plus some magic cookie) with the key in the server before embedding it in your HTML. In your JavaScript, validate the key (which comes in the URL) by decrypting the registration code. If the magic cookie matches, then you get a valid key and you can display the registration code to the user.
View Source will only reveal the encrypted registration code. Without the key, the snooper has no way to extract the registration code.
This means that you'll have a unique key per registration code, which should be the case for your registration system. The key you send to the user in an email, embedded into a link which they click as you said.