-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fetchLast and fetchMessages never return... #49
Comments
Just a thought but I think asking for 100,000 messages might be a problem. Have you tried less?
… On 12 Feb 2017, at 16:37, ikemuc ***@***.***> wrote:
I try to access my IMAP server with this code, which is based on your demo code:
`
import Foundation
import Postal
class MailManagerPostal {
var configuration: Configuration!
fileprivate lazy var postal: Postal = Postal(configuration: self.configuration)
fileprivate var messages: [FetchResult] = []
init(hostname: String, userName: String, password: String) {
log.debug("init called...")
configuration = Configuration(hostname: hostname, port: 993, login: userName, password: .plain(password), connectionType: .tls, checkCertificateEnabled: false)
log.debug("configuration created: \(self.configuration.description)")
postal.connect(timeout: Postal.defaultTimeout, completion: { [weak self] result in
log.debug("postal.connect completed.")
switch result {
case .success:
log.debug("fetching messages now.")
let indexset = IndexSet(0...100000)
self?.postal.fetchMessages("INBOX", uids: indexset, flags: [ .fullHeaders ], onMessage: { message in
log.debug("message : \(message.header)")
self?.messages.insert(message, at: 0)
}, onComplete: { error in
if let error = error {
log.error("fetch failed: \((error as NSError).localizedDescription)")
} else {
log.debug("connection successful")
}
log.debug("fetch complete.")
})
case .failure(let error):
log.error("connection failed: \((error as NSError).localizedDescription)")
}
})
log.debug("init finished.")
}
}
`
Problem: The last message I see is "fetching messages now.". Then nothing happens any more. WHat's happening here? Where is my mistake? The credentials I use work with using mailcode2 without a problem.
Some more questions:
How can I debug the IMAP requests?
Where can I find a documentation of the API?
Can I manipulate message, especially add custom headers to a message (or take a message, add custom headers, write it as a new message to the server and delete the old one...)?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#49>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ABe-sJlBM81qD0mwWRSIi5R9PX_E7G7Nks5rbzVJgaJpZM4L-iZq>.
|
The first try was exactly the demo code with fetchLast() with 50 messages. It didn't work. Then I tried fetchLast() with 3 messages. Then I changed it to fetchMessages... Always the same problem... |
… On 12 Feb 2017, at 17:29, ikemuc ***@***.***> wrote:
The first try was exactly the demo code with fetchLast() with 50 messages. It didn't work. Then I tried fetchLast() with 3 messages. Then I changed it to fetchMessages... Always the same problem...
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#49 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ABe-sFTaL08txDeETcNxHncd5n9hWeAdks5rb0FwgaJpZM4L-iZq>.
|
Tested it with 0..10 just to make sure. Same problem. I updated to 0.4.1 today, that didn't solve the problem... |
My issue was fixed with 0.4.1 but it sounds like you have a different issue. |
I shifted the initialization of postal to the init() method and now it works.
|
Now there are only the other questions unanswered ;-)
|
@ikemuc To answer your questions: - How can I debug the IMAP requests? let postal = Postal(configuration: ...)
postal.logger { log in
print(log)
} - Where can I find a documentation of the API? Unfortunately there isn't yet an official documentation of the API but we documented every public functions that you can access through xcode but I agree it's not enough. Everything should be ok to add jazzy or something like that if you want to do it, PR are welcome ! :) - Can I manipulate a message, especially add custom headers to a message (or take a message, add custom headers, write it as a new message to the server and delete the old one...)? No, Postal was first designed in first place only for fetching messages, not manipulating them. But I don't think it would be hard to add such features since libetpan propose an API for that. Your issue seems fixed so I close it. If you want new features, please submit an issue and we'll figure out how to implement them as quickly as possible 👍 |
I try to access my IMAP server with this code, which is based on your demo code:
`
`
Problem: The last message I see is "fetching messages now.". Then nothing happens any more. What's happening here? Where is my mistake? The credentials I use work with using mailcode2 without a problem.
Some more questions:
The text was updated successfully, but these errors were encountered: