MailMessage mailObj = new MailMessage();
mailObj.Subject = "aa";
mailObj.Body = "aaaaaaaa";
mailObj.From = "qhl@ymf.com";//这个地方如果随便写个邮箱地址,比如“aa@163.com”则只能发送到我的机器上的邮箱内(我的机器上装了Exchange),不能发到外网,只有写了我机器上的exchange上面开通了邮箱的用户的邮箱名,比如上面的“qhl@ymf.com”才能发到外网,其中qhl是我在ad中的用户,并且开通邮箱的,如果不开通邮箱也不能发到外网。
mailObj.To = "yumufeng1200@163.com";//我的163的邮箱(外网)
try
{
SmtpMail.Send(mailObj);
Response.Write("<script>alert('邮件发送成功!')</script>");
}
catch
{
Response.Write("<script>alert('邮件发送失败!')</script>");
}
请教高手,我想在一个没有ad和exchange 的机器上发邮件怎么办?
如果使用jmail或者使用cdonts的能详细告知也可以。。。
在线等,,,,,,
10 个解决方案
#1
http://sourceforge.net/projects/opensmtp-net/
----------------------------------------------------------------------
欢迎试用ASP.NET大文件上传组件(AspnetUpload 1.1 Release & 无刷新进度条)
http://www.cnblogs.com/bestcomy/archive/2004/06/09/14267.aspx
http://bestcomy.europe.webmatrixhosting.net
----------------------------------------------------------------------
----------------------------------------------------------------------
欢迎试用ASP.NET大文件上传组件(AspnetUpload 1.1 Release & 无刷新进度条)
http://www.cnblogs.com/bestcomy/archive/2004/06/09/14267.aspx
http://bestcomy.europe.webmatrixhosting.net
----------------------------------------------------------------------
#2
<% @LANGUAGE=VBSCRIPT %>
<%
dim startpage
dim endpage
startpage=int(request("start"))
endpage=int(request("end"))
Set pop3 = Server.CreateObject( "JMail.POP3" )
uid=trim(request("uid"))
pwd=trim(request("pwd"))
pop=trim(request("pop"))
if uid="" or pwd="" or pop="" then
response.redirect "receivemail.asp"
end if
if uid<>"" and pwd<>"" and pop<>"" then
response.cookies("uid")=trim(request("uid"))
response.cookies("pwd")=trim(request("pwd"))
response.cookies("pop")=trim(request("pop"))
else
uid=request.cookies("uid")
pwd=request.cookies("pwd")
pop=request.cookies("pop")
end if
pop3.Connect uid, pwd,pop
'pop3.Connect "agang0084", "921028", "pop3.sina.com.cn"
response.write "<div align=center>"
Response.Write( "您的收件箱有 <font color=red>" & pop3.count & "</font> 封邮件<br><br>" )
response.write "</div>"
'计算页数
pagenum=10 '一页共存几条记录
if pop3.count<pagenum then
pagecount=1
else
intcount=int(pop3.count/pagenum)
modcount=pop3.count mod pagenum
if modcount>0 then
pagecount=intcount+1 '如果总记录除以一页可存放的记录数有余数则页数必须加以一
else
pagecount=intcount
end if
end if
response.write ("您的邮件共有"&pagecount&"页 ")
'计算页码
page=trim(request("page"))
if page<>"" then
select case page
case "firstpage"
startpage=1
endpage=pagenum
case "lastpage"
startpage=(pagecount-1)*pagenum+1
endpage=pop3.count
case "next"
if endpage+10 > pop3.count then
startpage=(pagecount-1)*pagenum+1
endpage=pop3.count
else
startpage=startpage+10
endpage=endpage+10
end if
case "back"
if startpage=pagenum+1 then
startpage=1
endpage=pagenum
else
startpage=startpage-10
endpage=endpage-10
end if
end select
else
if pop3.count<pagenum then
startpage=1
endpage=pop3.count
else
startpage=1
endpage=pagenum
end if
end if
if pop3.count > 0 then
dim msg(20)
dim Attachments(20)
for i=1 to pop3.count
Set msg(i) = pop3.Messages.item(i)
Set Attachments(i) = msg(i).Attachments
next
%>
<%
if startpage=1 then
response.write "第一页 "
else
response.write "<a href=pop3.asp?page=firstpage&start="&startpage&"&end="&endpage&">第一页</a> "
end if
if endpage=pop3.count then
response.write "下一页 "
else
response.write "<a href=pop3.asp?page=next&start="&startpage&"&end="&endpage&">下一页</a> "
end if
if startpage=1 then
response.write "上一页 "
else
response.write "<a href=pop3.asp?page=back&start="&startpage&"&end="&endpage&">上一页</a> "
end if
if endpage=pop3.count then
response.write "最后一页 "
else
response.write "<a href=pop3.asp?page=lastpage&start="&startpage&"&end="&endpage&">最后一页</a> "
end if
response.write "当前记录是从第"
response.write startpage
response.write "封到"
response.write endpage
response.write "封的信件"
response.write "<br>"
response.write "<br>"
%>
<html>
<link rel="stylesheet" href="../../css/css.css" type="text/css">
<body bgcolor="eeeeee">
<TABLE width="100%" cellpadding="0" cellspacing="0" border="1" bordercolor="#eeeeee">
<% for i=startpage to endpage %>
<tr>
<td width="11%" bordercolor="#333333">主题:</td>
<td width="77%" bordercolor="#333333"> <%= msg(i).Subject %></td>
<td width="12%" bordercolor="#333333">
<div align="center"><a href="../deletemail.asp?messageid=<%=i%>">删除</a></div>
</td>
</tr>
<tr>
<td width="11%" bordercolor="#333333">发件人:</td>
<td colspan="2" bordercolor="#333333"> <a href="test_SENDMAIL.asp?mailto=<%=msg(i).from%>"><%= msg(i).From %></a> <font color="#FF0000">点击地址回复信件</font></td>
</tr>
<tr>
<td width="11%" bordercolor="#333333">附件个数:</td>
<td colspan="2" bordercolor="#333333"> <%= Attachments(i).count %> <font color="#FF0000">接收附件</font></td>
</tr>
<tr>
<td width="11%" bordercolor="#333333">正文:</td>
<td colspan="2" bordercolor="#333333"> <%= msg(i).Body %></td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<% next
%>
</TABLE>
</body>
</html>
<%
end if
pop3.Disconnect
%>
<%
dim startpage
dim endpage
startpage=int(request("start"))
endpage=int(request("end"))
Set pop3 = Server.CreateObject( "JMail.POP3" )
uid=trim(request("uid"))
pwd=trim(request("pwd"))
pop=trim(request("pop"))
if uid="" or pwd="" or pop="" then
response.redirect "receivemail.asp"
end if
if uid<>"" and pwd<>"" and pop<>"" then
response.cookies("uid")=trim(request("uid"))
response.cookies("pwd")=trim(request("pwd"))
response.cookies("pop")=trim(request("pop"))
else
uid=request.cookies("uid")
pwd=request.cookies("pwd")
pop=request.cookies("pop")
end if
pop3.Connect uid, pwd,pop
'pop3.Connect "agang0084", "921028", "pop3.sina.com.cn"
response.write "<div align=center>"
Response.Write( "您的收件箱有 <font color=red>" & pop3.count & "</font> 封邮件<br><br>" )
response.write "</div>"
'计算页数
pagenum=10 '一页共存几条记录
if pop3.count<pagenum then
pagecount=1
else
intcount=int(pop3.count/pagenum)
modcount=pop3.count mod pagenum
if modcount>0 then
pagecount=intcount+1 '如果总记录除以一页可存放的记录数有余数则页数必须加以一
else
pagecount=intcount
end if
end if
response.write ("您的邮件共有"&pagecount&"页 ")
'计算页码
page=trim(request("page"))
if page<>"" then
select case page
case "firstpage"
startpage=1
endpage=pagenum
case "lastpage"
startpage=(pagecount-1)*pagenum+1
endpage=pop3.count
case "next"
if endpage+10 > pop3.count then
startpage=(pagecount-1)*pagenum+1
endpage=pop3.count
else
startpage=startpage+10
endpage=endpage+10
end if
case "back"
if startpage=pagenum+1 then
startpage=1
endpage=pagenum
else
startpage=startpage-10
endpage=endpage-10
end if
end select
else
if pop3.count<pagenum then
startpage=1
endpage=pop3.count
else
startpage=1
endpage=pagenum
end if
end if
if pop3.count > 0 then
dim msg(20)
dim Attachments(20)
for i=1 to pop3.count
Set msg(i) = pop3.Messages.item(i)
Set Attachments(i) = msg(i).Attachments
next
%>
<%
if startpage=1 then
response.write "第一页 "
else
response.write "<a href=pop3.asp?page=firstpage&start="&startpage&"&end="&endpage&">第一页</a> "
end if
if endpage=pop3.count then
response.write "下一页 "
else
response.write "<a href=pop3.asp?page=next&start="&startpage&"&end="&endpage&">下一页</a> "
end if
if startpage=1 then
response.write "上一页 "
else
response.write "<a href=pop3.asp?page=back&start="&startpage&"&end="&endpage&">上一页</a> "
end if
if endpage=pop3.count then
response.write "最后一页 "
else
response.write "<a href=pop3.asp?page=lastpage&start="&startpage&"&end="&endpage&">最后一页</a> "
end if
response.write "当前记录是从第"
response.write startpage
response.write "封到"
response.write endpage
response.write "封的信件"
response.write "<br>"
response.write "<br>"
%>
<html>
<link rel="stylesheet" href="../../css/css.css" type="text/css">
<body bgcolor="eeeeee">
<TABLE width="100%" cellpadding="0" cellspacing="0" border="1" bordercolor="#eeeeee">
<% for i=startpage to endpage %>
<tr>
<td width="11%" bordercolor="#333333">主题:</td>
<td width="77%" bordercolor="#333333"> <%= msg(i).Subject %></td>
<td width="12%" bordercolor="#333333">
<div align="center"><a href="../deletemail.asp?messageid=<%=i%>">删除</a></div>
</td>
</tr>
<tr>
<td width="11%" bordercolor="#333333">发件人:</td>
<td colspan="2" bordercolor="#333333"> <a href="test_SENDMAIL.asp?mailto=<%=msg(i).from%>"><%= msg(i).From %></a> <font color="#FF0000">点击地址回复信件</font></td>
</tr>
<tr>
<td width="11%" bordercolor="#333333">附件个数:</td>
<td colspan="2" bordercolor="#333333"> <%= Attachments(i).count %> <font color="#FF0000">接收附件</font></td>
</tr>
<tr>
<td width="11%" bordercolor="#333333">正文:</td>
<td colspan="2" bordercolor="#333333"> <%= msg(i).Body %></td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<% next
%>
</TABLE>
</body>
</html>
<%
end if
pop3.Disconnect
%>
#3
To:comy(软件民工)
英文看不懂啊。。。
救命啊,老大,怎么解决啊。。。。
To:zhanqiangz(闲云野鹤)
我用C#是不是需要什么组件啊,怎么引用jmail?
英文看不懂啊。。。
救命啊,老大,怎么解决啊。。。。
To:zhanqiangz(闲云野鹤)
我用C#是不是需要什么组件啊,怎么引用jmail?
#4
各位高手,帮帮忙啊,,,,,,,,,,,,,,,,,,,,,,,
#5
指定一个smtp.server=“。。。”;
#6
指定了,发都发不出去了。。。
显示发送失败。。。
显示发送失败。。。
#7
郁闷啊。。。。。。。。。。。。。。
#8
MailMessage myMail = new MailMessage();
myMail.From = "from@form.com";
myMail.To = "to@to.com";
myMail.Subject = "test";
myMail.Priority = MailPriority.Low;
//myMail.BodyFormat = MailFormat.Html;
myMail.BodyFormat = MailFormat.Text;
myMail.Body = "测试数据";
//MailAttachment myAttachment = new MailAttachment("c:\attach\attach1.txt", MailEncoding.Base64);
//myMail.Attachments.Add(myAttachment);
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "name"); //set your username here
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "password"); //set your password here
SmtpMail.SmtpServer = "mail.server.com";
SmtpMail.Send(myMail);
myMail.From = "from@form.com";
myMail.To = "to@to.com";
myMail.Subject = "test";
myMail.Priority = MailPriority.Low;
//myMail.BodyFormat = MailFormat.Html;
myMail.BodyFormat = MailFormat.Text;
myMail.Body = "测试数据";
//MailAttachment myAttachment = new MailAttachment("c:\attach\attach1.txt", MailEncoding.Base64);
//myMail.Attachments.Add(myAttachment);
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "name"); //set your username here
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "password"); //set your password here
SmtpMail.SmtpServer = "mail.server.com";
SmtpMail.Send(myMail);
#9
微软标准帮助ms-help://MS.MSDNQTR.2003FEB.2052/enu_kbmapi/en-us/mapi/Q310233.htm
在vs.net文档中打开
在vs.net文档中打开
#10
.net2003中自带有一个smtp的例程。不过是C++版本的。
#1
http://sourceforge.net/projects/opensmtp-net/
----------------------------------------------------------------------
欢迎试用ASP.NET大文件上传组件(AspnetUpload 1.1 Release & 无刷新进度条)
http://www.cnblogs.com/bestcomy/archive/2004/06/09/14267.aspx
http://bestcomy.europe.webmatrixhosting.net
----------------------------------------------------------------------
----------------------------------------------------------------------
欢迎试用ASP.NET大文件上传组件(AspnetUpload 1.1 Release & 无刷新进度条)
http://www.cnblogs.com/bestcomy/archive/2004/06/09/14267.aspx
http://bestcomy.europe.webmatrixhosting.net
----------------------------------------------------------------------
#2
<% @LANGUAGE=VBSCRIPT %>
<%
dim startpage
dim endpage
startpage=int(request("start"))
endpage=int(request("end"))
Set pop3 = Server.CreateObject( "JMail.POP3" )
uid=trim(request("uid"))
pwd=trim(request("pwd"))
pop=trim(request("pop"))
if uid="" or pwd="" or pop="" then
response.redirect "receivemail.asp"
end if
if uid<>"" and pwd<>"" and pop<>"" then
response.cookies("uid")=trim(request("uid"))
response.cookies("pwd")=trim(request("pwd"))
response.cookies("pop")=trim(request("pop"))
else
uid=request.cookies("uid")
pwd=request.cookies("pwd")
pop=request.cookies("pop")
end if
pop3.Connect uid, pwd,pop
'pop3.Connect "agang0084", "921028", "pop3.sina.com.cn"
response.write "<div align=center>"
Response.Write( "您的收件箱有 <font color=red>" & pop3.count & "</font> 封邮件<br><br>" )
response.write "</div>"
'计算页数
pagenum=10 '一页共存几条记录
if pop3.count<pagenum then
pagecount=1
else
intcount=int(pop3.count/pagenum)
modcount=pop3.count mod pagenum
if modcount>0 then
pagecount=intcount+1 '如果总记录除以一页可存放的记录数有余数则页数必须加以一
else
pagecount=intcount
end if
end if
response.write ("您的邮件共有"&pagecount&"页 ")
'计算页码
page=trim(request("page"))
if page<>"" then
select case page
case "firstpage"
startpage=1
endpage=pagenum
case "lastpage"
startpage=(pagecount-1)*pagenum+1
endpage=pop3.count
case "next"
if endpage+10 > pop3.count then
startpage=(pagecount-1)*pagenum+1
endpage=pop3.count
else
startpage=startpage+10
endpage=endpage+10
end if
case "back"
if startpage=pagenum+1 then
startpage=1
endpage=pagenum
else
startpage=startpage-10
endpage=endpage-10
end if
end select
else
if pop3.count<pagenum then
startpage=1
endpage=pop3.count
else
startpage=1
endpage=pagenum
end if
end if
if pop3.count > 0 then
dim msg(20)
dim Attachments(20)
for i=1 to pop3.count
Set msg(i) = pop3.Messages.item(i)
Set Attachments(i) = msg(i).Attachments
next
%>
<%
if startpage=1 then
response.write "第一页 "
else
response.write "<a href=pop3.asp?page=firstpage&start="&startpage&"&end="&endpage&">第一页</a> "
end if
if endpage=pop3.count then
response.write "下一页 "
else
response.write "<a href=pop3.asp?page=next&start="&startpage&"&end="&endpage&">下一页</a> "
end if
if startpage=1 then
response.write "上一页 "
else
response.write "<a href=pop3.asp?page=back&start="&startpage&"&end="&endpage&">上一页</a> "
end if
if endpage=pop3.count then
response.write "最后一页 "
else
response.write "<a href=pop3.asp?page=lastpage&start="&startpage&"&end="&endpage&">最后一页</a> "
end if
response.write "当前记录是从第"
response.write startpage
response.write "封到"
response.write endpage
response.write "封的信件"
response.write "<br>"
response.write "<br>"
%>
<html>
<link rel="stylesheet" href="../../css/css.css" type="text/css">
<body bgcolor="eeeeee">
<TABLE width="100%" cellpadding="0" cellspacing="0" border="1" bordercolor="#eeeeee">
<% for i=startpage to endpage %>
<tr>
<td width="11%" bordercolor="#333333">主题:</td>
<td width="77%" bordercolor="#333333"> <%= msg(i).Subject %></td>
<td width="12%" bordercolor="#333333">
<div align="center"><a href="../deletemail.asp?messageid=<%=i%>">删除</a></div>
</td>
</tr>
<tr>
<td width="11%" bordercolor="#333333">发件人:</td>
<td colspan="2" bordercolor="#333333"> <a href="test_SENDMAIL.asp?mailto=<%=msg(i).from%>"><%= msg(i).From %></a> <font color="#FF0000">点击地址回复信件</font></td>
</tr>
<tr>
<td width="11%" bordercolor="#333333">附件个数:</td>
<td colspan="2" bordercolor="#333333"> <%= Attachments(i).count %> <font color="#FF0000">接收附件</font></td>
</tr>
<tr>
<td width="11%" bordercolor="#333333">正文:</td>
<td colspan="2" bordercolor="#333333"> <%= msg(i).Body %></td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<% next
%>
</TABLE>
</body>
</html>
<%
end if
pop3.Disconnect
%>
<%
dim startpage
dim endpage
startpage=int(request("start"))
endpage=int(request("end"))
Set pop3 = Server.CreateObject( "JMail.POP3" )
uid=trim(request("uid"))
pwd=trim(request("pwd"))
pop=trim(request("pop"))
if uid="" or pwd="" or pop="" then
response.redirect "receivemail.asp"
end if
if uid<>"" and pwd<>"" and pop<>"" then
response.cookies("uid")=trim(request("uid"))
response.cookies("pwd")=trim(request("pwd"))
response.cookies("pop")=trim(request("pop"))
else
uid=request.cookies("uid")
pwd=request.cookies("pwd")
pop=request.cookies("pop")
end if
pop3.Connect uid, pwd,pop
'pop3.Connect "agang0084", "921028", "pop3.sina.com.cn"
response.write "<div align=center>"
Response.Write( "您的收件箱有 <font color=red>" & pop3.count & "</font> 封邮件<br><br>" )
response.write "</div>"
'计算页数
pagenum=10 '一页共存几条记录
if pop3.count<pagenum then
pagecount=1
else
intcount=int(pop3.count/pagenum)
modcount=pop3.count mod pagenum
if modcount>0 then
pagecount=intcount+1 '如果总记录除以一页可存放的记录数有余数则页数必须加以一
else
pagecount=intcount
end if
end if
response.write ("您的邮件共有"&pagecount&"页 ")
'计算页码
page=trim(request("page"))
if page<>"" then
select case page
case "firstpage"
startpage=1
endpage=pagenum
case "lastpage"
startpage=(pagecount-1)*pagenum+1
endpage=pop3.count
case "next"
if endpage+10 > pop3.count then
startpage=(pagecount-1)*pagenum+1
endpage=pop3.count
else
startpage=startpage+10
endpage=endpage+10
end if
case "back"
if startpage=pagenum+1 then
startpage=1
endpage=pagenum
else
startpage=startpage-10
endpage=endpage-10
end if
end select
else
if pop3.count<pagenum then
startpage=1
endpage=pop3.count
else
startpage=1
endpage=pagenum
end if
end if
if pop3.count > 0 then
dim msg(20)
dim Attachments(20)
for i=1 to pop3.count
Set msg(i) = pop3.Messages.item(i)
Set Attachments(i) = msg(i).Attachments
next
%>
<%
if startpage=1 then
response.write "第一页 "
else
response.write "<a href=pop3.asp?page=firstpage&start="&startpage&"&end="&endpage&">第一页</a> "
end if
if endpage=pop3.count then
response.write "下一页 "
else
response.write "<a href=pop3.asp?page=next&start="&startpage&"&end="&endpage&">下一页</a> "
end if
if startpage=1 then
response.write "上一页 "
else
response.write "<a href=pop3.asp?page=back&start="&startpage&"&end="&endpage&">上一页</a> "
end if
if endpage=pop3.count then
response.write "最后一页 "
else
response.write "<a href=pop3.asp?page=lastpage&start="&startpage&"&end="&endpage&">最后一页</a> "
end if
response.write "当前记录是从第"
response.write startpage
response.write "封到"
response.write endpage
response.write "封的信件"
response.write "<br>"
response.write "<br>"
%>
<html>
<link rel="stylesheet" href="../../css/css.css" type="text/css">
<body bgcolor="eeeeee">
<TABLE width="100%" cellpadding="0" cellspacing="0" border="1" bordercolor="#eeeeee">
<% for i=startpage to endpage %>
<tr>
<td width="11%" bordercolor="#333333">主题:</td>
<td width="77%" bordercolor="#333333"> <%= msg(i).Subject %></td>
<td width="12%" bordercolor="#333333">
<div align="center"><a href="../deletemail.asp?messageid=<%=i%>">删除</a></div>
</td>
</tr>
<tr>
<td width="11%" bordercolor="#333333">发件人:</td>
<td colspan="2" bordercolor="#333333"> <a href="test_SENDMAIL.asp?mailto=<%=msg(i).from%>"><%= msg(i).From %></a> <font color="#FF0000">点击地址回复信件</font></td>
</tr>
<tr>
<td width="11%" bordercolor="#333333">附件个数:</td>
<td colspan="2" bordercolor="#333333"> <%= Attachments(i).count %> <font color="#FF0000">接收附件</font></td>
</tr>
<tr>
<td width="11%" bordercolor="#333333">正文:</td>
<td colspan="2" bordercolor="#333333"> <%= msg(i).Body %></td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<% next
%>
</TABLE>
</body>
</html>
<%
end if
pop3.Disconnect
%>
#3
To:comy(软件民工)
英文看不懂啊。。。
救命啊,老大,怎么解决啊。。。。
To:zhanqiangz(闲云野鹤)
我用C#是不是需要什么组件啊,怎么引用jmail?
英文看不懂啊。。。
救命啊,老大,怎么解决啊。。。。
To:zhanqiangz(闲云野鹤)
我用C#是不是需要什么组件啊,怎么引用jmail?
#4
各位高手,帮帮忙啊,,,,,,,,,,,,,,,,,,,,,,,
#5
指定一个smtp.server=“。。。”;
#6
指定了,发都发不出去了。。。
显示发送失败。。。
显示发送失败。。。
#7
郁闷啊。。。。。。。。。。。。。。
#8
MailMessage myMail = new MailMessage();
myMail.From = "from@form.com";
myMail.To = "to@to.com";
myMail.Subject = "test";
myMail.Priority = MailPriority.Low;
//myMail.BodyFormat = MailFormat.Html;
myMail.BodyFormat = MailFormat.Text;
myMail.Body = "测试数据";
//MailAttachment myAttachment = new MailAttachment("c:\attach\attach1.txt", MailEncoding.Base64);
//myMail.Attachments.Add(myAttachment);
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "name"); //set your username here
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "password"); //set your password here
SmtpMail.SmtpServer = "mail.server.com";
SmtpMail.Send(myMail);
myMail.From = "from@form.com";
myMail.To = "to@to.com";
myMail.Subject = "test";
myMail.Priority = MailPriority.Low;
//myMail.BodyFormat = MailFormat.Html;
myMail.BodyFormat = MailFormat.Text;
myMail.Body = "测试数据";
//MailAttachment myAttachment = new MailAttachment("c:\attach\attach1.txt", MailEncoding.Base64);
//myMail.Attachments.Add(myAttachment);
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "name"); //set your username here
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "password"); //set your password here
SmtpMail.SmtpServer = "mail.server.com";
SmtpMail.Send(myMail);
#9
微软标准帮助ms-help://MS.MSDNQTR.2003FEB.2052/enu_kbmapi/en-us/mapi/Q310233.htm
在vs.net文档中打开
在vs.net文档中打开
#10
.net2003中自带有一个smtp的例程。不过是C++版本的。