2013-10-28 53 views
0

我曾经使用邮件程序0.8.1,并尝试创建演示应用程序发送达特朗邮件,但它不工作。 这是我的代码:飞镖邮件不发送邮件

var options = new GmailSmtpOptions() 
    ..username = 'my gmail account' 
    ..password = 'my gmail pass'; 
    var emailTransport = new SmtpTransport(options); 

    var envelope = new Envelope() 
    ..from = '[email protected]' 
    ..recipients.add('[email protected]') 
    ..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')); 

但是当我运行程序的时候,不显示任何信息。 有人可以帮助我吗? thanks1

回答

0

我没有用过这个包还没有,但它看起来你缺少一些send调用会成功导致.then()/.catchError()

0

信封无法发送邮件本身,你必须使用SmtpTransport为此:

emailTransport.send(envelope) 
     .then((_) => print('Email sent!))) 
     .catchError((e) => print('Error occurred: $e'));