如何在C#中使用.eml对象发送自动电子邮件 [英] How to send automated email using .eml objects in C#

查看:361
本文介绍了如何在C#中使用.eml对象发送自动电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有多个带有不同消息的.eml(Outlook电子邮件格式)模板(例如一个用于成功电子邮件,一个用于失败电子邮件等).
根据某些条件,我需要选择.eml模板,填写所需的数据(收件人",发件人",消息"等)并发送电子邮件.

例如:如果任务成功,则系统应选择.eml模板,其中包含成功完成任务的消息,请使用该.eml模板创建电子邮件并发送电子邮件.

有可能吗?

我该怎么办?

代码示例将不胜感激.

关于

Hi,

I have multiple .eml (Outlook Email Format) templates with different messages (like one for success email, one for failure email etc).
Based on some conditions, I need to choose an .eml template, fill in the required data (To, From, Message etc)and send the email.

For Example: If a task is successful, system should choose the .eml template, which contains message for successful task completion, use that .eml template for creating an email and send the email.

Is it possible?

How can I do that?

A code sample will be appreciated.

Regards

推荐答案

monu_1983写道:
monu_1983 wrote:

有可能吗?


是的:)


Yup :)

monu_1983写道:
monu_1983 wrote:

我该怎么办?


  1. 检查是否需要发送电子邮件
  2. 将模板加载到字符串中
  3. 用实际值替换模板中的占位符(重命名其中一个.eml文件转换为.txt文件并在记事本中打开-它是您可以操纵的字符串)
  4. 发送电子邮件(您可以在密件抄送中添加多个地址,如果需要,可以将收件人"设置为自己)想要一次性向很多人发送电子邮件,只是不要过度使用)



您可能需要进行更多研究,例如;

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆