我正在使用mailer包发送邮件,它的主机是在中国非常流行的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);然而,它失败了。我有没有落下什么东西?
发布于 2019-01-22 02:53:29
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);(请注意ssl: true参数)。
此外,2.2.0版现在具有SMTP服务器定义功能(类似于gmail功能)。
https://stackoverflow.com/questions/54160800
复制相似问题