email - 使用依赖服务实现发送电子邮件功能
问题描述
使用依赖服务实现发送电子邮件功能。以下字段应可配置To、Cc、Bcc、Subject 和 Details。
我尝试了许多示例,例如example1和Example2等等。这些都没有帮助。
我可以在使用 Xam.Plugins.Messaging 的代码中做到这一点,但我需要使用 Dependency 服务来实现电子邮件服务。我不知道如何解决这个问题。有什么建议么?
解决方案
API 文档包括使用cc的示例
// Alternatively use EmailBuilder fluent interface to construct more complex e-mail with multiple recipients, bcc, attachments etc.
var email = new EmailMessageBuilder()
.To("to.plugins@xamarin.com")
.Cc("cc.plugins@xamarin.com")
.Bcc(new[] { "bcc1.plugins@xamarin.com", "bcc2.plugins@xamarin.com" })
.Subject("Xamarin Messaging Plugin")
.Body("Well hello there from Xam.Messaging.Plugin")
.Build();
emailMessenger.SendEmail(email);
和附件
var email = new EmailMessageBuilder()
.To("to.plugins@xamarin.com")
.Subject("Xamarin Messaging Plugin")
.Body("Well hello there from Xam.Messaging.Plugin")
.WithAttachment("<path_to_picture>", "image/jpeg");
.Build();
推荐阅读
- node.js - Ansible 使用 nvm 安装节点
- java - 无法在 Ubuntu 中将 Jetty9 安装为服务
- javascript - 如何使用 html/javascript 从 oauth 授权流解析重定向 URL
- json - 修改 Json 使用成 React 漂亮的拖放
- c++ - 如何为 Doxygen 样式的文件头配置 CLion?
- php - API 搜索中不允许的方法
- mysql - 在 mysql 工作台中正向工程 ER 图时出现错误 1064
- python - 成本函数不断增加
- powershell - 表达式或语句中出现意外的标记“-UFormat”
- angular - 补丁值不适用于嵌套输入反应形式Angular 5