Last updated:
0 purchases
mailer2
Mailer #
Note: this is a temporary fork of Kai Sellgren's Mailer (https://github.com/kaisellgren/mailer) for aggressive support of Reply-To and List-Unsubscribe
API Reference
Who Uses #
Quire - a simple, collaborative, multi-level task management tool.
Introduction #
Mailer is an easy to use library for composing and sending emails in Dart.
Mailer supports file attachments, HTML emails and multiple transport methods.
Features #
Plaintext and HTML emails
Unicode support
Attachments
Secure (filters and sanitizes all fields context-wise)
Use any SMTP server like Gmail, Live, SendGrid, Amazon SES
SSL/TLS support
Pre-configured services (Gmail, Live, Mail.ru, etc.). Just fill in your username and password.
Filing bug tickets #
Please call printDebugInformation() from the mailer package and send the output along with your helpful explanation of what went wrong.
TODO #
All possible SMTP authentication methods (now just LOGIN)
Sendmail
Stream attachments
String-based attachments
Examples #
Sending an email with SMTP #
In this example we send an email using a Gmail account.
import 'package:mailer/mailer.dart';
main() {
// If you want to use an arbitrary SMTP server, go with `new SmtpOptions()`.
// This class below is just for convenience. There are more similar classes available.
var options = new GmailSmtpOptions()
..username = 'your gmail username'
..password = 'your gmail password'; // Note: if you have Google's "app specific passwords" enabled,
// you need to use one of those here.
// How you use and store passwords is up to you. Beware of storing passwords in plain.
// Create our email transport.
var emailTransport = new SmtpTransport(options);
// Create our mail/envelope.
var envelope = new Envelope()
..from = '[email protected]'
..recipients.add('[email protected]')
..bccRecipients.add('[email protected]')
..subject = 'Testing the Dart Mailer library'
..attachments.add(new Attachment(file: new File('path/to/file')))
..text = 'This is a cool email message. Whats up?'
..html = '<h1>Test</h1><p>Hey!</p>';
// Email it.
emailTransport.send(envelope)
.then((envelope) => print('Email sent!'))
.catchError((e) => print('Error occurred: $e'));
}
copied to clipboard
License #
This library is licensed under MIT.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.