首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >把QQ邮箱送进Dart

把QQ邮箱送进Dart
EN

Stack Overflow用户
提问于 2019-01-12 23:02:47
回答 1查看 235关注 0票数 0

我正在使用mailer包发送邮件,它的主机是在中国非常流行的QQ

代码语言:javascript
运行
复制
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);

然而,它失败了。我有没有落下什么东西?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-01-22 02:53:29

qq smtp服务器需要ssl标志:

代码语言:javascript
运行
复制
String username = 'xx@qq.com';
String password = 'xx';

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

(请注意ssl: true参数)。

此外,2.2.0版现在具有SMTP服务器定义功能(类似于gmail功能)。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54160800

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档