佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 926|回复: 5

asp.net c# send email

[复制链接]
发表于 3-9-2008 09:53 AM | 显示全部楼层 |阅读模式
asp.net c# send email                                                                                                                                                                                                                                                                                                                        各位大大,
小弟急需关于如何在asp.net c# send email 的code!
当我按“submit”,那个表格就会 mail 到相关人的邮箱,
相关人的邮此是在database take out.

help me pls!
urgent
回复

使用道具 举报


ADVERTISEMENT

发表于 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 | 显示全部楼层
去IT forum 问会好些。
我建议http://www.daniweb.com
申请账号,发问题,蛮不错。不然就去www.google.com 吧。
回复

使用道具 举报

发表于 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>都要自己来
加油哦!!
回复

使用道具 举报

Follow Us
您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 23-12-2025 06:55 PM , Processed in 0.128279 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表