如何编写电子邮件代码? [英] How to write a code for email?

查看:192
本文介绍了如何编写电子邮件代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿那里

我想创建一个表单以便从用户那里获取信息,包括文本框,DropDownLists和提交按钮。它的工作方式是,当用户点击提交按钮时,来自控制器的数据将被发送到我的电子邮件地址。但是在这个过程中有一个问题,我不知道如何以我在电子邮件中作为表格的形式安排输入的数据。

hey there
i want to create a form in order to get information from users, including text boxes, DropDownLists and a submit button. the way it works is that, when the user clicks on submit button, the data from controllers will be sent to my email address. but there is a problem in this process, i don’t know how to arrange the entered datas in a way that i receive them as a table in my email.

推荐答案

如果您擅长HTML,那么您可以创建基于HTML的表格,并为其输入值。这样,您的表格将使用您自己的数据生成。之后,告诉框架您的电子邮件正文是HTML格式,



If you are good in HTML, then you can create a table based in HTML, and enter the values to it. This way your table would be generated using your own data. After that, tell the framework that your email body is in HTML format,

mailMessage.IsBodyHtml = true;





了解更多关于 IsBodyHtml [ ^ 。想知道如何在.NET框架中发送电子邮件吗?阅读我的这篇文章:通过.NET框架发送电子邮件,以及一般问题 - 使用C#代码 [ ^ ]



Read more about IsBodyHtml on MSDN[^]. Want to know how to send the emails in .NET framework also? Read this article of mine: Sending emails over .NET framework, and general problems – using C# code[^]


这篇关于如何编写电子邮件代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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