Published: 07 Nov 2022 โบ Updated: 07 Nov 2022
๐ง Send Email from ๐ฒ Mobile-app using Flutter ๐งโ๐ป
Step 1
Open Terminal & navigate to your project directory.
Step 2
Add dependencies by running following command.
flutter pub add flutter_email_sender
flutter pub add url_launcher
Step 3
- You can add following code snippet
- It could be anywhere.
- Ideally, you can put it on a button-press event.
- If you are putting it inside a method, make sure you mark the function as
async
final Email email = Email(
body: 'I want to send email and This is where I add email body',
subject: 'Email subject goes here',
recipients: ['some-email@gmail.com'],
isHTML: false,
);
try {
// this will open native email composer
await FlutterEmailSender.send(email);
} catch (e) {
// upon failure (if no email configured)
// we'll try to launch email composer with URL scheme
var data = Uri.encodeFull(
"subject=Email subject goes here&body=I want to send email and This is where I add email body");
var url =
Uri.parse('mailto:some-email@gmail.com?$data');
launchUrl(url);
log('Something went wrong ${e.toString()}');
}
- For Android, you may have to add following lines in
AndroidManifest.xmlfile.
<manifest package="com.mycompany.myapp">
<queries>
<intent>
<action android:name="android.intent.action.SENDTO" />
<data android:scheme="mailto" />
</intent>
</queries>
</manifest>
That's it. You're all set.
Hope that, above details were helpful to you.
Who am I?
- I am
@sagarkothari88.
- I am currently working on a mobile application for 3Speak community members
Support Me Back ๐
- Vote me as your hive witness - https://hivesigner.com/sign/account-witness-vote?witness=sagarkothari88&approve=1
- Upvote my content
- Follow my channel
Support 3Speak
Cheers
Have a good one
---
Posted from 3Speak iOS App for 3Speak
Developed and maintained by @sagarkothari88
Leave ๐ง Send Email from ๐ฒ Mobile-app using Flutter ๐งโ๐ป to:
Read more #hive-181436 posts
Best Posts From Sagar Kothari
We have not curated any of sagarkothari88's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From Sagar Kothari
- HiveSuite Dev Update: Persistent Nav & Scroll Restoration
- HiveSuite Dev Update: Market Prices Popup & Persistent Nav Ex
- HiveReactKit Dev Update: Image Preview, Translation & Wallet Enhancements
- HiveReactKit v1.2.5: Scroll Restoration Magic โจ #opensource #hive
- HiveSuite Can Now Publish to ANY Hive App ๐ #opensource #hive
- Re-Snaps, Smarter Replies & Bulletproof Node Routing ๐ #hive #opensource
- HiveReactKit Now Plays 3Speak Audio + Smarter Nodes ๐ง #opensource #hive
- Re-Snaps, Meme Maker & Twitter Embeds Land in HiveSuite ๐ #opensource #hive
- HiveSuite Never Goes Down Now ๐ Smart API Failover #opensource #hive
- HiveSuite Adds Inline Replies & Rich Notifications โก #opensource #hive