I am trying to use mailer2 dart package to send email from the Web app. I got the following error while execution.

Unsupported operation: Platform._localHostname while sending mail from client Dart app

When I searched for other related posts, I found out that the mailer2 package uses 'dart:io' (EXCEPTION: Unsupported operation: Platform._localHostname) which cannot be used for web apps. So, Is there any other package that suffices my requirement of sending mails through a web app?

My dart Code is as follows:

void send() {
var options = new GmailSmtpOptions()
..username = '[email protected]'
..password = '****'; 
// Create our email transport.
var emailTransport = new SmtpTransport(options);

// Create our mail/envelope.
var envelope = new Envelope()
..from = '[email protected]'
..recipients.add('[email protected]')
..subject = 'Test'
..text = 'Hurray ! You have reached your goal!';

// Email it.
  .then((envelope) => print('Email sent!'))
  .catchError((e) => print('Error occurred: $e'));

Please help, Thanks in advance!

0 Answers