Sending Email In Flutter

Awais Ur Rehman
2 min readFeb 14, 2021

--

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

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.

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!

--

--

Awais Ur Rehman

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