|
查看: 926|回复: 5
|
asp.net c# send email
[复制链接]
|
|
|
asp.net c# send email 各位大大,
小弟急需关于如何在asp.net c# send email 的code!
当我按“submit”,那个表格就会 mail 到相关人的邮箱,
相关人的邮此是在database take out.
help me pls!
urgent |
|
|
|
|
|
|
|
|
|
|
发表于 3-9-2008 10:20 AM
|
显示全部楼层
回复 1# seekeong 的帖子
Send Email in C# Code
In order to send email in C# code, do the following:
// create mail message object
MailMessage mail = new MailMessage();
mail.From = ""; // put the from address here
mail.To = ""; // put to address here
mail.Subject = ""; // put subject here
mail.Body = ""; // put body of email here
SmtpMail.SmtpServer = ""; // put smtp server you will use here
// and then send the mail
SmtpMail.Send(mail); |
|
|
|
|
|
|
|
|
|
|
发表于 3-9-2008 10:20 AM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
发表于 3-9-2008 12:02 PM
|
显示全部楼层
看看这个...
<% @Page Language="C#" %>
<% @Import Namespace="System.Web.Mail" %>
<%
string strTo = "receiver@hotmail.Com";
string strFrom = "sender@hotmail.com";
string strSubject = "title";
SmtpMail.Send(strFrom, strTo, strSubject,
"body text here");
%>
和这个...
<% @Page Language="C#" %>
<% @Import Namespace="System.Web.Mail" %>
<%
MailMessage msgMail = new MailMessage();
msgMail.To = "receiver@hotmail.Com";
msgMail.Cc = "receiver@hotmail.Com";
msgMail.From = "sender@hotmail.com";
msgMail.Subject = "title";
msgMail.BodyFormat = MailFormat.Html;
string strBody = "<html><body><b>Hello World</b>" +
" <font color=\"red\">ASP.NET</font></body></html>";
msgMail.Body = strBody;
SmtpMail.Send(msgMail);
%> |
|
|
|
|
|
|
|
|
|
|
发表于 3-9-2008 09:32 PM
|
显示全部楼层
原帖由 CK_MyviSE 于 3-9-2008 10:20 AM 发表 
Send Email in C# Code
In order to send email in C# code, do the following:
// create mail message object
MailMessage mail = new MailMessage();
mail.From = ""; // put the from address ...
就这样。但记得要using System.Net.Mail |
|
|
|
|
|
|
|
|
|
|
发表于 4-9-2008 03:30 PM
|
显示全部楼层
刚完成这个任务, 用vb.net。。。
我的是自己写html body,
不难做,只是要写很多coding,连<tr>, <strong>都要自己来
加油哦!! |
|
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|