如何在C#中使用.eml对象发送自动电子邮件 [英] How to send automated email using .eml objects in C#
问题描述
我有多个带有不同消息的.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
推荐答案
有可能吗?
是的:)
Yup :)
我该怎么办?
- 检查是否需要发送电子邮件
- 将模板加载到字符串中
- 用实际值替换模板中的占位符(重命名其中一个.eml文件转换为.txt文件并在记事本中打开-它是您可以操纵的字符串)
- 发送电子邮件(您可以在密件抄送中添加多个地址,如果需要,可以将收件人"设置为自己)想要一次性向很多人发送电子邮件,只是不要过度使用)
您可能需要进行更多研究,例如;
- 我的电子邮件地址来自哪里?您在往返"中放置的内容存储在哪里?
- 模板存储在哪里?占位符看起来如何?
- 在什么条件下触发发送?是用户发起的操作,还是更复杂的操作?
- 在网上寻找代码段,以便以您喜欢的.NET语言发送电子邮件.或使用手册 [
You might want to research a bit more, like;
- Where are my emailaddresses coming from? The things you put in the To and Fro, where is that stored?
- Where are the templates stored? How do the placeholders look?
- What are the conditions on which you trigger the sending? Is it a user-initiated action, or something more complex?
- Hunt the web for a code-snippet to send emails in your favorite .NET language. Or use the one from the manual[^]
monu_1983写道:monu_1983 wrote:将感谢代码示例.
这个项目的哪一部分?您可以使用Google for MailMerge-examples:)
For which part of this project? You could Google for MailMerge-examples :)
这篇关于如何在C#中使用.eml对象发送自动电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!