Reputation: 99
I am trying to create a feedback page that allow users to submit issues. I tried using Mailer to send emails, not sure if that is the best solution. Wanted to get people's ideas?
Upvotes: 6
Views: 9848
Reputation: 75
If you use mailer, the user does not have to write their own email and the your app won't redirect them to the mail app to write a specific email
Upvotes: 0
Reputation: 11269
Using Package Flutter Email Sender (you can even send html format)
import 'package:flutter_email_sender/flutter_email_sender.dart';
Your button:
onTap: () async {await sendEmail(user.email);} // replace user.email with email String
The function:
sendEmail(String emailAddress) async {
final Email email = Email(
body:
'Hello World',
subject: 'Testing email on flutter',
recipients: [emailAddress],
//cc: ['[email protected]'],
//bcc: ['[email protected]'],
//attachmentPaths: ['/path/to/attachment.zip'],
isHTML: false,
);
Upvotes: 1
Reputation: 857
You can use url_launcher: https://pub.dev/packages/url_launcher
It provides a great example:
final Uri _emailLaunchUri = Uri(
scheme: 'mailto',
path: '[email protected]',
queryParameters: {
'subject': 'Example Subject & Symbols are allowed!'
}
);
// ...
// mailto:[email protected]?subject=Example+Subject+%26+Symbols+are+allowed%21
launch(_emailLaunchUri.toString());
This would launch e-mail app with your data entered for your user.
Upvotes: 5