Cannot get Sent or Drafts folder with JavaMail - jakarta-mail

I'm using JavaMail to get a list of ALL the folders in an IMAPStore:
store.getDefaultFolder().list("*")
This usually works fine with accounts at Gmail, Yahoo etc. However, for some IMAP providers the list method returns only one folder, namely the inbox. Yet, when using the same account via Thunderbird I can also access the account's Sent and Drafts folders. Does anybody have an idea what I'm doing wrong in getting the folders?
PS: Also directly checking for folders like "Sent", "Sent items","Drafts" etc. via
store.getFolder(foldername).exists()
always returns false.
Supplement: These are the properties I use to create the Session (javax.mail.Session) which I get the store from:
props.put("mail.store.protocol","imaps");
props.put("mail.imaps.host","imap.testhost.com");
props.put("mail.imaps.port","993");
props.put("mail.imaps.auth","true");
props.put("mail.imaps.ssl.trust","*");
props.put("mail.imaps.partialfetch","false");

Related

SSRS - Managing Folder, GET AllowedActions Method Returns 404

I'm using SQL Server 2017 Reporting Service and I see that something is wrong with my permissions. I'm in Administrator group in SSRS machine, I'm can manage most of the folders in SSRS browser web app but I can't manage some of them...
For example,
I newly created a folder called CWB, I can manage CWB folder's own permissions
When I navigate into CWB folder, I can't manage folders or permissions inside of CWB folder
Then I realize that when i click to manage button on folder, SSRS sends GET request called AllowedActions and the request returns with users permitted actions, so I examine the body of that request and found this,
For CWB folder, I get the permissions successfuly AllowedActions method returns Status: (200),
But when I navigate into CWB folder and try to manage another folder inside of CWB folder, AllowedActions method returns Status: (404) as seen below,
And the error message says,
An error has occurred. Something went wrong. Please try again later.
Other group members of Administrator can manage/edit same folder/folders except me. I will very appreciate if anyone help me to fix this issue.
Thank you for reading my issue.
According to this article,
Encoding should be the problem. So try and look at your browser language. Changing your broweser language to English will fix your problem.

IMAP Folder structures

I have to implement an client application that need to sync IMAP messages. But currently IMAP server that store messages are not ready yet and i need to finish my task. So i am using to Gmail for testing my implementation of retrieving IMAP messages.
I simulate what the spec said for the folder structures in Gmail. Creating folder and subfolders.
/Default
/Default/User1/Session1
/Default/User1/Session1/File1
/Default/User1/Session2
/Default/User2/Session1
/Default/User3
Then i use java mail to list out the folders under default.
store.getFolder("Default").list("*");
I loop the folder to print out the folder count and folder name. The returned folder includes all the subfolders of each User like above.
I would like to know is this the way that IMAP server return for the folder list query? all the subfolders under it?
If you use list(*"), yes. If you only want one level use list("%"). This is well explained in the javadocs.

Avoid google oauth2 client secret in code

I'm writing a small c program which connects to the google api via Oauth2.
Therefore I need to send a client secret to google.
I store this secret in my code, which I want to push to github, but how can I avoid to show my client secret to everybody who looks at my code?
use a configuration file where you'll store the API key... you have many options, the simplest being writing the key directly into the file, more sophisticated being using some kind of serializers (like json, xml, inifile etc...), the right option is up to you (usually, you'll want to serialize if you want to store several options in the file).
You can also set the key as a program argument, if you don't mind the key to be visible in the process list of your host.
And be sure not to push your already existing git history to git hub, but create a new repository, or all your previous patches (with the key) will be public ;)
Storing secret (and ideally any string literals) in code is wrong - store it in a resource (text) file and don't push it to Git.
If you are searching for where to find out your Client Secret for your Google Drive apss. then follow this step.
Go to your project
Click Credential.
After that you will get all the details about your project like client
id, redirect uri etc. But there you will click on button "Download
Jason" and after downloading a file you will get your CLIENT SECRET.
Please look at the picture.

302 status when copying data to another app in AppEngine

I'm trying to use the "Copy to another app" feature of AppEngine and keep getting an error:
Fetch to http://datastore-admin.moo.appspot.com/_ah/remote_api failed with status 302
This is for a Java app but I followed the instructions on setting up a default Python runtime.
I'm 95% sure it's an authentication issue and the call to remote_api is redirecting to the Google login page. Both apps use Google Apps as the authentication mechanism. I've also tried copying to and from a third app we have which uses Google Accounts for authentication.
Notes:
The user account I log in with is an Owner on all three apps. It's a Google Apps account (if that wasn't obvious).
I have a gmail account this is an Owner on all three apps as well. When I log in to the admin console with it, I don't see the datastore admin console at all when I click it.
I'm able to use the remote_api just fine from the command-line after I enter my details
Tried with both the Python remote_api built-in and the Java one.
I've found similar questions/blog posts about this, one of which required logging in from a browser, then manually submitting the ACSID cookie you get after that's done. Can't do that here, obviously.
OK, I think I got this working.
I'll refer to the two appIDs as "source" and "dest".
To enable datastore admin (as you know) you need to upload a Python project with the app.yaml and appengine_config.py files as described in the docs.
Either I misread the docs or there is an error. The "appID" inthe .yaml should be the app ID you are uploading to to enable DS admin.
The other appID in the appengine_config file, specifically this line:
remoteapi_CUSTOM_ENVIRONMENT_AUTHENTICATION = (
'HTTP_X_APPENGINE_INBOUND_APPID', ['appID'])
Should be the appID of the "source", ID the app id of where the data is coming from in the DS copy operation.
I think this line is what allows the source appID to be authenticated as having permissions to write to the "dest" app ID.
So, I changed that .py, uploaded again to my "dest" app ID. To be sure I made this dummy python app as default and left it as that.
Then on the source app ID I tried the DS copy again, and all the copy jobs were kicked off OK - so it seems to have fixed it.

saving appengine mail from spam filters

One of my clients uses Trend Micro InterScan Messaging Security to protect their internal mail services.
Suddenly InterScan decided to filter out all messages coming from Google App Engine.
Unfortunately they haven't been able to whitelist the sender address as each e-mail gets a different one. For example, *3ckihSOVMMHlZHSL.JSMMHlZHSL.JS*#apphosting.bounces.google.com, with everything before the # being variable.
Update I'm including this screenshot of how Interscan sees the incoming e-mail. Notice that all senders are different:
If I look into the e-mail headers, the apphosting domain appears inside the Return-Path field:
Return-Path: <36kSiSwYIBh0883XL3E7.5EH883XL3E7.5E#apphosting.bounces.google.com>
The "From" field looks ok. It says what I set it to say, but the spam filter only looks at the Return-Path.
My client sysadmin doesn't want to whitelist the whole apphosting domain, as it wouldn't be only whitelisting my application.
How could I bypass this e-mail filters if I can't get an unique sender?
Thanks,
You can't change the return-path header of mail sent by App Engine. The way I see it, you have two options:
Whitelist everything from App Engine. Spam from App Engine is not a big problem, because it's expensive to send in the huge numbers spammers need, and we're constantly monitoring for spamming and shutting spammers down.
Whitelist based on the X-Google-Appengine-App-Id header, which will be set to the app ID of your app.
I am not well versed in spam filters, but it seems to me that if it can only whitelist based on one field, it is pretty lame. Unfortunately that does not help you. If this is an important client, and they absolutely refuse to budge, I see two possible paths forward:
Do some research into interscan to see if you can give the client some pointers (tactfully) on how to configure it to whitelist in such a way that your mail can get through, but only your mail.
Maintain a server outside app engine specifically for the purpose of sending emails. You can build a super simple web app that just sends out emails, and call it from within your app engine app.

Resources