Sending Email In Flutter

Good to see you again now let’s talk about how to send email using flutter. For this, we need an external dart package called mailer.

Install the mailer package

  • First, add the following line to the pubspec.yaml file in your flutter application.

dependencies:

mailer: ^3.0.3

Image for post
Image for post
this is mail plugin
  • After that you must install the package, just write the following code in your command line Run Flutter Pub Get

then u can use now mailer for sending our mails

Now let’s dive into the code!

Here I am creating a Gmail server for sending emails. Though we can create other servers, creating a gmaiGmailver is the easiest so today I’m going to concentrate on that one.

Image for post
Image for post
code for mailer ❤

This is simple code for mailer to send a mail they u may create a ui flutter page and call it on button and set through your own gmails

NOTE :

gmail user name and password must be include for admin side.

Conclusion

This is the end of the article, and before I finish this article I want to say, if I had made any mistakes or if there is an easy way to do this please add a comment below about it.

Thank you and HAPPY CODING!

I am flutter/dart developer trying to learn new things .

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store