浣跨敤SQL Server鍙戦侀偖浠
鍙戝竷: 2008-6-30 23:26 | 浣滆: admin | 鏌ョ湅: 21娆

浣跨敤SQL Server鍙戦侀偖浠
鐑 鑽
銆愬瓧浣擄細灏 澶с
浣跨敤SQL Server鍙戦侀偖浠
浣滆咃細- 鏂囩珷鏉ユ簮锛- 鐐瑰嚮鏁帮細1467 鏇存柊鏃堕棿锛2006-4-20 
鍦.NET涓紝澶у鐭ラ亾锛屽彲浠ヤ娇鐢⊿ystem.Web.Mail鏉ュ彂閫侀偖浠躲傚湪Framework 1.1涓嬫敮鎸侀獙璇併
private void Page_Load(object sender, System.EventArgs e)
{
MailMessage mail = new MailMessage();
mail.To = "me@mycompany.com";
mail.From = "you@yourcompany.com";
mail.Subject = "this is a test email.";
mail.Body = "Some text goes here";
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "my_username_here"); //set your username here
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "super_secret"); //set your password here
SmtpMail.SmtpServer = "mail.mycompany.com"; //your real server goes here
SmtpMail.Send( mail );
}
浠ュ墠鎴戞浘鍐欒繃鍦.NET涓嬪彂閫侀偖浠剁殑鏂规硶锛岃瑙侊細
http://dev.csdn.net/develop/article/17/17189.shtm
SQL Server涓紝鎴戜滑涓鑸娇鐢⊿QL鏈韩鐨勯偖浠跺彂閫佹柟寮忥紝浣嗛渶瑕侀厤缃瓻xchage Server銆丱utlook绛夛紝涔熸槸涓涓瘮杈冪箒鐞愮殑浜嬫儏銆傚緢澶氫汉鎶辨ㄨ閰嶇疆涓嶆垚鍔熴
鍏跺疄锛屾垜浠彲浠ュ湪 SQL Server涓垱寤 OLE 瀵硅薄瀹炰緥锛岃皟鐢↖IS SMTP鑷甫鐨勫彂閫佺粍浠舵潵瀹炵幇閭欢鍙戦併
鎴戜滑寤虹珛杩欎釜瀛樺偍杩囩▼锛屼綘闇瑕佷慨鏀圭殑鍦版柟鏄紝SmtpServer鐨勫悕瀛
Create PROCEDURE sys_sendmail @From varchar(100) , @To varchar(100) , @Bcc varchar(500), @Subject varchar(400)=" ", @Body ntext =" "
AS
Declare @object int
Declare @hr int
EXEC @hr = sp_OACreate 'CDO.Message', @object OUT
EXEC @hr = sp_OASetProperty @object, 'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/sendusing").Value','2'
EXEC @hr = sp_OASetProperty @object, 'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/smtpserver").Value', 'smtp.163.com'




发表于 2009-1-5 19:48
| 











