如何通过邮件中的邮件发送文件附件

发布于 2025-02-09 19:58:27 字数 760 浏览 0 评论 0原文

您好,我试图使用Mailer Flutter发送带有附件的电子邮件,因此II指定了文件路径,但是当发送电子邮件时,我只找到没有附件的文本,什么错了? 。这是代码:

final equivalentMessage = Message()
  ..from = Address(username, '***** ')
  ..recipients.add(Address('********'))
  //..ccRecipients.addAll([Address('[email protected]'), '[email protected]'])
  //..bccRecipients.add('[email protected]')
  ..subject = 'Test Dart Mailer library :: 
              

hello i'm trying to send email with attachment using mailer flutter so i i specified the file path but when the email is sent i find just the text without the attachment what is wrong ? . this the code :

final equivalentMessage = Message()
  ..from = Address(username, '***** ')
  ..recipients.add(Address('********'))
  //..ccRecipients.addAll([Address('[email protected]'), '[email protected]'])
  //..bccRecipients.add('[email protected]')
  ..subject = 'Test Dart Mailer library :: ???? :: ${DateTime.now()}'
  ..text = 'This is the plain text.\nThis is line 2 of the text part.'
  ..html =
      '<h1>Test</h1>\n<p>Hey! Here is some HTML content</p><img src="cid:[email protected]"/>'
  ..attachments = [
    FileAttachment(File('/path/hello.txt'))

  ]; 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文