-
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
How to fetch email body #95
Comments
I had some issues, too, but was able to get it to work with the following snippet: let postal = Postal(configuration: .init(hostname: "imap.myemailprovider.de", port: 993, login: "[email protected]", password: .plain("mypassword"), connectionType: .tls, checkCertificateEnabled: false))
postal.connect { result in
switch result {
case .success:
postal.fetchLast("INBOX", last: 1, flags: [ .body, .fullHeaders ], onMessage: { message in
message.body?.allParts.forEach { part in
let data = part.data?.decodedData
print(String(decoding: data!, as: UTF8.self))
}
}, onComplete: { error in
if let error = error {
print("error: \(error)")
} else {
print("done")
}
})
case .failure(let error):
print("error: \(error)")
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am able to fetch message subject but I cannot fetch what's written in thr body of email. Plz help in swift
The text was updated successfully, but these errors were encountered: