用C#发送邮件的几种方法
1 JavaScript发送邮件
<script language="javascript">
function SendMail() {
document.location = "mailto:seat@wicresoft.com;?subject=Feedback";
alert("ddd");
}
</script>
2 用Office发送邮件。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Net.Mail;
using Microsoft.Office.Interop.Outlook;
using Microsoft.Office;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click1(object sender, EventArgs e)
{
Microsoft.Office.Interop.Outlook.Application outlookObj = new Microsoft.Office.Interop.Outlook.Application();
MailItem Item = (Microsoft.Office.Interop.Outlook.MailItem)outlookObj.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
Item.To = "seat@info.com";
Item.CC = "seat@info.com";
Item.Subject = "hello";
Item.Body = "hello";
Item.Send();
}
}
但是,恼人的是,用这个方法发送的话,Outlook会产生一个对话框,提醒用户有未知的应用程序正在冒充她的名义发送邮件。
大家可以去试试。如果找到回避这个警告框的方法,请告诉我,谢.
相关文档:
接上一篇
删除原genre属性,删除leixing=love的所有结点。
1 原xml文件 bookstore.xml
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
<book genre="love" ISBN="1234123">
<title>who am i </title>
<author>who</aut ......
记取记录集
create procedure getArticle
as
select * from Article_Content
GO
asp.net 调用方法
SqlConnection Conn = new SqlConnection();
Conn.ConnectionString = Data.Connstr();
Conn.Open();
......
C#利用webrequest计算待下载的文件大小
string URL = textBox1.Text;
string filetype = URL.Substring(URL.LastIndexOf(".") + 1, (URL.Length - URL.LastIndexOf(".") - 1));
filetypevalue.Text = filetype.ToUpper();
string filename = URL.Substring(URL.LastIn ......
1.总是用属性 (Property) 来代替可访问的数据成员
2.在 readonly 和 const 之间,优先使用 readonly
3.在 as 和 强制类型转换之间,优先使用 as 操作符
4.使用条件属性 (Conditional Attributes) 来代替条件编译语句 #if
5.总是为自定义类重载 ToString 方法
6.区别值类型和引用类型
7.使用不可变的值类型(Immu ......
1、引用的空间:
using System.DirectoryServices;
using System.ServiceProcess;
2、调用
private void button1_Click(object sender, EventArgs e)
{
String webSiteName = "默认网站";
String pathToRoot = @"C:\Inetpub\wwwroot";
CreateWebSite(webSit ......