如何发送电子邮件与扑动的收件人是已知的,但发件人的变化?



我已经读过mailer和flutter_email_sender是如何工作的。但我不认为它们能解决我的问题。我需要能够始终发送电子邮件到相同的地址,例如emailsample@gmail.com但是要更改发件人,因为每个使用我的应用程序的用户都会有不同的电子邮件。我在网上找不到任何能帮我的东西。那么,有没有一种方法可以在不询问电子邮件密码的情况下,向不同的发件人发送电子邮件呢?例如,它们是某些功能无法运行的电子邮件

你可以使用包url-launcher

OutlinedButton.icon(
icon: Icon(Icons.email),
onPressed: () => setState(() {
_launched = _createMail(
'mailto:emailsample@gmail.com?subject=subject of email');
},
),
label: Text('E-Mail')),

添加到您的小部件:

Future<void> _createMail(String url) async {
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}

相关内容

最新更新