简体   繁体   English

在Dart中发送qq邮件

[英]Send qq mail in Dart

I am using mailer package to send mail whose host is QQ which is very popular in China. 我正在使用邮寄包裹发送寄件人QQ邮件,这在中国非常流行。

String username = 'xx@qq.com';
String password = 'xx';

final smtpServer = new SmtpServer("smtp.qq.com", port: 465, username: username, password: password);

// Create our message.
final message = new Message()
  ..from = new Address(username, 'Your name')
  ..recipients.add('receiver@qq.com')
  ..subject = 'Test Dart Mailer library :: 😀 :: ${new DateTime.now()}'
  ..text = 'This is the plain text.\nThis is line 2 of the text part.'
  ..html = "<h1>Test</h1>\n<p>Hey! Here's some HTML content</p>";

final sendReports = await send(message, smtpServer);

However it fails. 但是它失败了。 Is there anything I left? 我还剩下什么吗?

The qq smtp server requires the ssl flag: QQ smtp服务器需要ssl标志:

String username = 'xx@qq.com';
String password = 'xx';

final smtpServer = new SmtpServer("smtp.qq.com", ssl: true, port: 465, username: username, password: password);

(Note the ssl: true argument). (请注意ssl: true参数)。

In addition version 2.2.0 now has a qq(username, password) SMTP server definition function (similar to the gmail function). 另外,版本2.2.0现在具有qq(username, password) SMTP服务器定义功能(类似于gmail功能)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM