2013-10-28 55 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'));