zoukankan
html css js c++ java
EMAIL发送代码
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
>
<
HTML
>
<
HEAD
>
<
title
>
WebForm1
title
>
<
script
language
="C#"
runat
="server"
>
...
void
Page_Load(Object sender, EventArgs e)
...
{
this
.ddlMailFormat.Items.Add(
new
ListItem( System.Enum.GetName(
typeof
(System.Web.Mail.MailFormat), MailFormat.Text), MailFormat.Text.ToString()));
this
.ddlMailFormat.Items.Add(
new
ListItem( System.Enum.GetName(
typeof
(System.Web.Mail.MailFormat), MailFormat.Html), MailFormat.Html.ToString()));
}
void
btnSend_Click(object sender, System.EventArgs e)
...
{
try
...
{
MailMessage Message
=
new
MailMessage();
if
(
this
.chkRequireLogin.Checked )
...
{
Message.Fields.Add(
"
http://schemas.microsoft.com/cdo/configuration/smtpauthenticate
"
,
"
1
"
);
//
basic authentication
Message.Fields.Add(
"
http://schemas.microsoft.com/cdo/configuration/sendusername
"
, txtUserName.Text );
//
set your username here
Message.Fields.Add(
"
http://schemas.microsoft.com/cdo/configuration/sendpassword
"
, txtPassword.Text );
//
set your password here
}
Message.To
=
txtTo.Text;
Message.Cc
=
txtCC.Text;
Message.Bcc
=
txtBCC.Text;
Message.From
=
txtFrom.Text;
Message.Subject
=
txtSubject.Text;
Message.BodyFormat
=
(MailFormat)System.Enum.Parse(
typeof
(MailFormat), ddlMailFormat.SelectedValue );
Message.Body
=
txtMessage.Text;
SmtpMail.SmtpServer
=
txtServer.Text;
SmtpMail.Send(Message);
lblResult.Text
=
"
Mail Sent
"
;
}
catch
( Exception ex )
...
{
lblResult.Text
=
ex.ToString();
}
}
script
>
<
meta
content
="Microsoft Visual Studio .NET 7.1"
name
="GENERATOR"
>
<
meta
content
="C#"
name
="CODE_LANGUAGE"
>
<
meta
content
="JavaScript"
name
="vs_defaultClientScript"
>
<
meta
content
="http://schemas.microsoft.com/intellisense/ie5"
name
="vs_targetSchema"
>
HEAD
>
<
body
MS_POSITIONING
="GridLayout"
>
<
form
id
="Form1"
method
="post"
runat
="server"
>
<
asp:Label
id
="lblServer"
style
="Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP: 16px"
runat
="server"
Width
="104px"
>
Server:
asp:Label
>
<
asp:Label
id
="lblMessage"
style
="Z-INDEX: 121; LEFT: 16px; POSITION: absolute; TOP: 280px"
runat
="server"
Width
="104px"
>
Message:
asp:Label
>
<
asp:Label
id
="lblMailFormat"
style
="Z-INDEX: 120; LEFT: 16px; POSITION: absolute; TOP: 248px"
runat
="server"
Width
="104px"
>
Mail Format:
asp:Label
>
<
asp:Label
id
="lblSubject"
style
="Z-INDEX: 119; LEFT: 16px; POSITION: absolute; TOP: 224px"
runat
="server"
Width
="104px"
>
Subject:
asp:Label
>
<
asp:Label
id
="lblBCC"
style
="Z-INDEX: 118; LEFT: 16px; POSITION: absolute; TOP: 200px"
runat
="server"
Width
="104px"
>
BCC:
asp:Label
>
<
asp:Label
id
="lblCC"
style
="Z-INDEX: 117; LEFT: 16px; POSITION: absolute; TOP: 176px"
runat
="server"
Width
="104px"
>
CC:
asp:Label
>
<
asp:TextBox
id
="txtSubject"
style
="Z-INDEX: 114; LEFT: 128px; POSITION: absolute; TOP: 224px"
tabIndex
="9"
runat
="server"
>
Test of CDONT
asp:TextBox
>
<
asp:TextBox
id
="txtBCC"
style
="Z-INDEX: 113; LEFT: 128px; POSITION: absolute; TOP: 200px"
tabIndex
="8"
runat
="server"
>
asp:TextBox
>
<
asp:TextBox
id
="txtCC"
style
="Z-INDEX: 112; LEFT: 128px; POSITION: absolute; TOP: 176px"
tabIndex
="7"
runat
="server"
>
asp:TextBox
>
<
asp:TextBox
id
="txtTo"
style
="Z-INDEX: 111; LEFT: 128px; POSITION: absolute; TOP: 152px"
tabIndex
="6"
runat
="server"
>
asp:TextBox
>
<
asp:TextBox
id
="txtFrom"
style
="Z-INDEX: 110; LEFT: 128px; POSITION: absolute; TOP: 128px"
tabIndex
="5"
runat
="server"
>
asp:TextBox
>
<
asp:TextBox
id
="txtPassword"
style
="Z-INDEX: 109; LEFT: 152px; POSITION: absolute; TOP: 88px"
tabIndex
="4"
runat
="server"
Width
="128px"
TextMode
="Password"
>
asp:TextBox
>
<
asp:TextBox
id
="txtUserName"
style
="Z-INDEX: 108; LEFT: 152px; POSITION: absolute; TOP: 64px"
tabIndex
="3"
runat
="server"
Width
="128px"
>
asp:TextBox
>
<
asp:Label
id
="lblTo"
style
="Z-INDEX: 106; LEFT: 16px; POSITION: absolute; TOP: 152px"
runat
="server"
Width
="104px"
>
To:
asp:Label
>
<
asp:Label
id
="lblFrom"
style
="Z-INDEX: 105; LEFT: 16px; POSITION: absolute; TOP: 128px"
runat
="server"
Width
="104px"
>
From:
asp:Label
>
<
asp:Label
id
="lblPassword"
style
="Z-INDEX: 104; LEFT: 40px; POSITION: absolute; TOP: 88px"
runat
="server"
Width
="104px"
>
Password:
asp:Label
>
<
asp:Label
id
="lblUserName"
style
="Z-INDEX: 102; LEFT: 40px; POSITION: absolute; TOP: 64px"
runat
="server"
Width
="104px"
>
User Name:
asp:Label
>
<
asp:CheckBox
id
="chkRequireLogin"
style
="Z-INDEX: 103; LEFT: 16px; POSITION: absolute; TOP: 40px"
runat
="server"
Width
="232px"
Text
="Server Requires Login"
tabIndex
="2"
>
asp:CheckBox
>
<
asp:TextBox
id
="txtServer"
style
="Z-INDEX: 107; LEFT: 128px; POSITION: absolute; TOP: 16px"
runat
="server"
tabIndex
="1"
>
asp:TextBox
>
<
asp:DropDownList
id
="ddlMailFormat"
style
="Z-INDEX: 115; LEFT: 128px; POSITION: absolute; TOP: 248px"
tabIndex
="10"
runat
="server"
Width
="152px"
>
asp:DropDownList
>
<
asp:TextBox
id
="txtMessage"
style
="Z-INDEX: 116; LEFT: 16px; POSITION: absolute; TOP: 304px"
tabIndex
="11"
runat
="server"
Width
="280px"
Height
="136px"
Rows
="20"
MaxLength
="255"
>
This is a test of CDONT Functionality.
asp:TextBox
>
<
asp:Button
id
="btnSend"
style
="Z-INDEX: 122; LEFT: 240px; POSITION: absolute; TOP: 456px"
tabIndex
="12"
runat
="server"
Text
="Send"
>
asp:Button
>
<
asp:Label
id
="lblResult"
style
="Z-INDEX: 123; LEFT: 24px; POSITION: absolute; TOP: 496px"
runat
="server"
Width
="100%"
Height
="200px"
>
asp:Label
>
form
>
body
>
HTML
>
查看全文
相关阅读:
wapp HTTP Error 404. The requested resource is not found.
JS 动态修改json字符串
使用VS2017新建的Web项目报错:Package Microsoft.Composition 1.0.27 is not compatible with netcoreapp1.1
java park unpark
DOUHAO
Thread dump
线程状态
https://stackoverflow.com/questions/20795295/why-jstack-out-says-thread-state-is-runnable-while-socketread
rocketmq-flink
the-implementation-of-epoll
原文地址:https://www.cnblogs.com/xiaozhang/p/195628.html
最新文章
SpringBoot+Jpa+SpringSecurity+Redis+Vue的前后端分离开源系统
GitHub Vue项目推荐|Vue+Element实现的电商后台管理系统功能丰富
GitHub Python项目推荐|瓦力Devops开源项目代码部署平台持续部署
最强在线文件格式转换(支持200+文件格式如常用的PDF,DOCX,JPG,GIF,MP3,MP4,FLV,MOBI)(通用)
干货分享 | 3个开发IoT项目的开源物联网平台
IOS 微信、QQ、叮叮等APP虚拟定位 实在太好用了
12306 抢票项目霸榜 GitHub,标星即将破万
搭建一个自动化测试平台,有效提高工作效率和降低沟通成本
js json日期格式转换日期方法
C# 获取客户端ip地址
热门文章
C#委托Action、Action<T>、Func<T>、Predicate<T>
json 数据 添加 删除 排序
js 操作json对象增删改
C# 根据第几周和季度 获取开始时间和结束时间
C#.NET MVC 枚举转dictionary自动装载生成下拉框
c# 创建压缩包并下载文件
js 四级联动
C#用正则表达式对IP进行排序
C#实现office文档转换为PDF格式
C# 中 List.Sort运用(IComparer<T>)排序用法
Copyright © 2011-2022 走看看