Skip to content
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

Commandline App | Postal library | postal.connect | I get nothing back (no error or else) #93

Open
sm-a opened this issue Jan 10, 2020 · 0 comments

Comments

@sm-a
Copy link

sm-a commented Jan 10, 2020

Hello,

I am new in this library and I hope I get help here. I use Swift 5.

When I use the following code I get only "ENDED" but nothing else back in the console. No error message. What I am doing wrong?

A happy New Year to all.

Greetings,
Sven

import Foundation      
import Postal  
    
let postal : Postal = Postal(configuration: Configuration(hostname: "email.none.none", port: 993, login: "none@none.none", password: .plain("test"), connectionType: .tls, checkCertificateEnabled: true, batchSize: 1000, spamFolderName: "junk"))  
    
func getEmail() {  
    let indexset = IndexSet(integer: 1)  
    postal.fetchMessages("INBOX", uids: indexset, flags: [ .headers ], onMessage: { email in  
        print("new email received: \(email)")  
    }, onComplete: { error in  
        if error == error {  
            print("an error occured: \(error)")  
        }  
    })  
}  
    
postal.connect { result in  
    switch result {  
    case .success:  
        getEmail()  
    case .failure(let error):  
        print("error: \(error)")  
    }  
}  
    
print("ENDED")  
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant