'Flutter (mailer package): mailing from within the app. not receiving mail
I am working on an app in flutter, and I would like to have a "give feedback option". this form consists of 1 text field where the message is typed, and 1 button to submit and sent the feedback.
I am currently using the mailer(1) dart package to do this for me, but so far I have not been able to send and receive a mail in my inbox.
I have used flutter_mailer and mailer, both without any success. I followed instructions and tried to do the same as the example, but I can not get it working.
the show code is the method to handle the email.
void sendEmail(String message) async {
_isLoading = true;
notifyListeners();
print(message);
String username = 'matthijs******@gmail.com';
String password = '******';
final SmtpServer server = gmail(username, password);
final feedbackMessage = new Message()
..from = new Address(username, _authUser.email)
..recipients.add('[email protected]')
..ccRecipients.addAll([_authUser.email])
..subject = 'Feedback from ${_authUser.id} ${new DateTime.now()}'
..text = message
..html = "<h1>Test</h1>\n<p>message</p>";
final sendReports = await send(feedbackMessage, server, timeout:
Duration(seconds: 15));
_isLoading = false;
notifyListeners();
print('email send');
}
i would like to see an email appear in my inbox with the written message of the user in there.
Solution 1:[1]
so, it seems like you should create an app password of the desired account.
you can ollow this link https://support.google.com/accounts/answer/185833?hl=en to create an app password. use this password in conjunction with the email in the mailer implementation and everything should work!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Igor D |