[英]Dart mailer don't send mail
I was use mailer 0.8.1 and try create demo app to send mail in dartlang but it don't work. 我使用的是mailer 0.8.1,并尝试创建演示应用程序以dartlang发送邮件,但是它不起作用。 This my code:
这是我的代码:
var options = new GmailSmtpOptions()
..username = 'my gmail account'
..password = 'my gmail pass';
var emailTransport = new SmtpTransport(options);
var envelope = new Envelope()
..from = 'testmailer@gmail.com'
..recipients.add('testmailer@gmail.com')
..subject = 'Testing mailer'
..text = 'This is test mailer'
..html = '<h1>Test send mail</p>';
.then((success) => print('Email sent! $success'))
.catchError((e) => print('Error occured: $e'));
but when i run app it don't print anything. 但是当我运行应用程序时,它不会打印任何内容。 Somebody can help me?
有人可以帮助我吗? thanks1
谢谢1
我没有用过这个包还没有,但它看起来你缺少一些send
呼叫会成功导致.then()
/ .catchError()
The envelope can not send the mail itself you have to use the SmtpTransport for that: 信封本身无法发送邮件,您必须为此使用SmtpTransport:
emailTransport.send(envelope)
.then((_) => print('Email sent!)))
.catchError((e) => print('Error occurred: $e'));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.