asp.net,c#,vb,vbs,js各个语言的邮箱发送源代码
发送端以163为例
一、asp.net版 using System.Web.Mail; //命名空间引用
c#
MailMessage mail = new MailMessage();
mail.To = "shadow103@qq.com"; //接受人的邮箱
mail.from = "xxx@163.com"; //你自己的邮箱(注意qq邮箱不行)
mail.Subject = "你好帅哥"; //邮箱标题
mail.Body = "正文";
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing","2")
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //stmp验证
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", 你邮箱帐号");
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "你邮箱密码");
SmtpMail.SmtpServer = "smtp.163.com"; //代理邮件服务器
SmtpMail.Send(mail);
vb
Dim mail As New MailMessage()
mail.To = "shadow103@qq.com"
mail.from = "xxx@163.com"
mail.Subject = "你好帅哥"
mail.Body = "正文"
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing","2")
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1") 'stmp验证
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "你邮箱帐号")
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "你邮箱密码 ")
SmtpMail.SmtpServer = "smtp.163.com" '代理邮件服务器
SmtpMail.Send(mail)
相关文档:
在ASP.NET出现错误时,应该先检查ASP.NET环境是否正确搭建,比如以下几个方面:
1、是否安装相应版本的.NET Framework程序,并打好了补丁。
2、IIS是否安装运行正常,站点路径及ASP.NET版本是否配置正确。
3、在IIS WEB服务扩展中,是否允许了ASP.NET扩展。
4、是否有安全防护软件禁止向Windows和Temp文件夹写入文 ......
ASP.NET 2.0
文件1: Deafault.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&l ......
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text;
names ......
<system.web>
<!--********出错页的设定********-->
<customErrors mode="On" defaultRedirect="~/Error.htm"> </customErrors> ......
新建一个默认的ASP.NET MVC2应用程序,系统会默认的生成包含基本功能的应用程序,查看这些生成的代码,可帮助我们理解ASP.NET MVC2。下面是对URL路由的理解,以备忘。
一、Global.asax.cs中的代码:
public class MvcApplication : System.Web.HttpApplication
{
&n ......