Comments (6)
Hi, r'...' tells dart to treat the text as a regular expression. You can escape special characters with a backslash: 'xxxx\$xxxx'. Other than that I cannot see any apparent mistakes.
from imap_client.
My understanding is that r
is raw string
. From https://www.learndartprogramming.com/fundamentals/strings-and-raw-strings-in-dart/
Maybe I'm confused, but I don't think so (at least, at this moment)
Defining raw Strings in Dart
What is a raw strings in Dart: In Dart programming language, raw strings are a type of strings where special characters such as \ do not get special treatment.
Raw strings are useful when you want to define a String that has a lot of special characters.
from imap_client.
Wrong language, my bad - you are correct. Your code seems to be equal to the example which has been tested with gmail, so it should be alright...
from imap_client.
I created a Google account with userid/password shown below. It still fails. You can try this code
import 'dart:io';
import 'package:imap_client/imap_client.dart';
Future<void> main() async {
// print log, helpful for debugging
printImapClientDebugLog();
var client = ImapClient();
// connect
await client.connect('imap.gmail.com', 993, true);
// authenticate
final response = await client.authenticate(
ImapPlainAuth('[email protected]', r'ujbzZ4uhmd'));
print('reponse ok? ${response == ImapTaggedResponse.ok}');
if (response != ImapTaggedResponse.ok) {
exit(1);
}
// get folder
var inbox = await client.getFolder('Inbox');
// get "BODY" for message 1
print(await inbox.fetch(['BODY'], messageIds: [1]));
// get "BODYSTRUCTURE" for message 1
print(await inbox.fetch(['BODYSTRUCTURE'], messageIds: [1]));
// close connection
await client.logout();
}```
Logs:
dart bin/emailTest.dart
[INFO] imap_client: Connecting to imap.gmail.com at port 993 with secure mode on
[INFO] imap_client: S: * OK Gimap ready for requests from 24.183.26.195 j10mb205926323jam
[INFO] imap_client: C: A1 CAPABILITY
[INFO] imap_client: S: * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 XYZZY SASL-IR AUTH=XOAUTH2 AUTH=PLAIN AUTH=PLAIN-CLIENTTOKEN AUTH=OAUTHBEARER AUTH=XOAUTH
A1 OK Thats all she wrote! j10mb205926323jam
[INFO] imap_client: C: A2 AUTHENTICATE PLAIN
[INFO] imap_client: S: +
[INFO] imap_client: C: AHZpam9wb3Q5NTBAZ21haWwuY29tAHVqYnpaNHVobWQ=
[INFO] imap_client: S: A2 NO [AUTHENTICATIONFAILED] Invalid credentials (Failure)
reponse ok? false
from imap_client.
Did you enable imap in gmail's options? Other than that I really cannot see why this shouldn't work
from imap_client.
When I went to check the Google Settings, I was prompted with warning that a call from an unsecure app had been blocked because it didn't meet the standards Google has. It asked if the block was correct or if I were the person trying to access the account. Once I replied that I was blocked, it took me through these screens about reducing the security. Sorry I didn't get a picture of the first dialog.
And now it works:
mailTest]$ dart bin/emailTest.dart
[INFO] imap_client: Connecting to imap.gmail.com at port 993 with secure mode on
[INFO] imap_client: S: * OK Gimap ready for requests from 24.183.26.195 q187mb93813797ywf
[INFO] imap_client: C: A1 CAPABILITY
[INFO] imap_client: S: * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 XYZZY SASL-IR AUTH=XOAUTH2 AUTH=PLAIN AUTH=PLAIN-CLIENTTOKEN AUTH=OAUTHBEARER AUTH=XOAUTH
A1 OK Thats all she wrote! q187mb93813797ywf
[INFO] imap_client: C: A2 AUTHENTICATE PLAIN
[INFO] imap_client: S: +
[INFO] imap_client: C: AHZpam9wb3Q5NTBAZ21haWwuY29tAHVqYnpaNHVobWQ=
[INFO] imap_client: S: * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 UIDPLUS COMPRESS=DEFLATE ENABLE MOVE CONDSTORE ESEARCH UTF8=ACCEPT LIST-EXTENDED LIST-STATUS LITERAL- SPECIAL-USE APPENDLIMIT=35651584
A2 OK [email protected] authenticated (Success)
from imap_client.
Related Issues (20)
- Support [NEWNAME xy] response code
- Use classes with fixed fields instead of maps
- STARTTLS does not refresh capabilities
- Russian? HOT 4
- Utf8 folder names HOT 1
- Error parsing mail with inline attachment HOT 3
- How to login use xoauth2? HOT 1
- Error parsing mail with pgp attachment HOT 1
- Add proper utf-8 support
- searching for UNSEEN emails is returning empty list HOT 1
- [flutter_imap_mail] flutter packages get HOT 1
- trigger on incoming new un-read messages HOT 6
- Folder "inbox" could not be selected. HOT 3
- Can't analysis Chinese HOT 4
- Listener for New Messages HOT 2
- Fetching email in web browser giving Raw socket constructor error HOT 1
- Decode Header Fields HOT 1
- Cannot connect to email server HOT 1
- IMAP Client connected to server but not authenticating HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imap_client.