Skip to content

emailjs-com/emailjs-flutter

Repository files navigation

Official EmailJS SDK for Flutter

SDK for EmailJS.com customers.
Use you EmailJS account for sending emails.

Disclaimer

This is a flutter-only version, otherwise use the REST API.

Links

Official SDK Docs

Intro

EmailJS helps to send emails using client-side technologies only. No server is required – just connect EmailJS to one of the supported email services, create an email template, and use our SDK to trigger an email.

Usage

Install EmailJS SDK:

$ flutter pub add emailjs 

Examples

send email

import package:emailjs/emailjs.dart

Map<String, dynamic> templateParams = {
  'name': 'James',
  'notes': 'Check this out!'
};

try {
  await EmailJS.send(
    '<YOUR_SERVICE_ID>',
    '<YOUR_TEMPLATE_ID>',
    templateParams,
    '<YOUR_PUBLIC_KEY>',
  );
  print('SUCCESS!');
} catch (error) {
  print(error.toString());
}

init (optional)

import package:emailjs/emailjs.dart

// set Public Key as global settings
EmailJS.init('<YOUR_PUBLIC_KEY>');

try {
  // send the email without dynamic variables
  await EmailJS.send(
    '<YOUR_SERVICE_ID>',
    '<YOUR_TEMPLATE_ID>',
  );
  print('SUCCESS!');
} catch (error) {
  print(error.toString());
}

About

Official EmailJS SDK for Flutter

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages