0

私はメーラー 0.8.1 を使用していて、dartlang でメールを送信するデモ アプリを作成しようとしましたが、機能しません。この私のコード:

  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'));

しかし、アプリを実行しても何も印刷されません。誰かが私を助けることができますか?ありがとう1

4

2 に答える 2

0

エンベロープは、そのために SmtpTransport を使用する必要があるメール自体を送信できません。

  emailTransport.send(envelope)
      .then((_) => print('Email sent!)))
      .catchError((e) => print('Error occurred: $e'));
于 2014-05-19T11:20:53.777 に答える
0

このパッケージはまだ使用していませんが、成功すると/sendにつながる呼び出しが欠落しているようです.then().catchError()

于 2014-01-28T15:04:03.167 に答える