不想另外安装第三方的发邮件组件,想直接利用ms的。
请问在vb里如何用mapi来发送邮件(好像mapi是outlook和oe自带有的吧),需要像在oe里发邮件一样先手工设置好发信帐号吗?能不能像jmail一样在发信时指定smtp服务器及发信验证用户名和密码?
哪里有cdonts发邮件的源码?我需要能指定发邮件的smtp及认证用户名和密码的那个版本的,这就相当于jmail能实现的功能了,好像低版本的cdo不支持,汗~~~~~
下面是使用winsock实现的发送邮件,但其它问题仍未解决,等待高手
estmp.vbp
-------------------------------------------
type=exe
object={248dd890-bb45-11cf-9abc-0080c7e7b78d}#1.0#0; mswinsck.ocx
form=frmmail.frm
startup="form1"
helpfile=""
title="email发送"
exename32="email.exe"
command32=""
name="email"
helpcontextid="0"
compatiblemode="0"
majorver=1
minorver=0
revisionver=0
autoincrementver=0
serversupportfiles=0
versioncompanyname="dapha.net"
versionfiledescription="email发送,支持服务器认证,超文本邮件内容"
versionlegalcopyright="copyright 2002 dapha.net"
versionproductname="email发送软件"
compilationtype=0
optimizationtype=0
favorpentiumpro(tm)=0
codeviewdebuginfo=0
noaliasing=0
boundscheck=0
overflowcheck=0
flpointcheck=0
fdivcheck=0
unroundedfp=0
startmode=0
unattended=0
retained=0
threadperobject=0
maxnumberofthreads=1
[ms transaction server]
autorefresh=1
frmmail.frm
-----------------------------------------
version 5.00
object = "{248dd890-bb45-11cf-9abc-0080c7e7b78d}#1.0#0"; "mswinsck.ocx"
begin vb.form form1
borderstyle = 1 'fixed single
caption = "邮件发送程序(支持smtp服务器验证)"
clientheight = 5550
clientleft = 45
clienttop = 330
clientwidth = 5805
linktopic = "form1"
maxbutton = 0 'false
scaleheight = 5550
scalewidth = 5805
startupposition = 3 'windows default
begin mswinsocklib.winsock winsock1
left = 2640
top = 2520
_extentx = 741
_extenty = 741
_version = 393216
end
begin vb.textbox txtmessage1
height = 1695
left = 0
multiline = -1 'true
tabindex = 8
text = "frmmail.frx":0000
tooltiptext = "这里为超文本信件内容"
top = 3480
width = 5775
end
begin vb.textbox user
height = 270
left = 3960
tabindex = 4
top = 840
width = 1575
end
begin vb.textbox subject
height = 270
left = 960
tabindex = 3
text = "你好"
top = 1320
width = 2295
end
begin vb.textbox txtserver
height = 270
left = 960
tabindex = 2
text = "smtp.etang.com"
top = 960
width = 2295
end
begin vb.textbox txtpwa
height = 270
imemode = 3 'disable
left = 3960
passwordchar = "*"
tabindex = 5
top = 1200
width = 1575
end
begin vb.textbox getaddress
height = 300
left = 960
tabindex = 1
top = 600
width = 2295
end
begin vb.textbox txtfrom
height = 300
left = 960
tabindex = 0
top = 240
width = 2295
end
begin vb.commandbutton cmdexit
caption = "退出"
height = 375
left = 4680
tabindex = 9
top = 240
width = 975
end
begin vb.commandbutton cmdsend
caption = "发送"
default = -1 'true
height = 375
left = 3360
tabindex = 6
top = 240
width = 975
end
begin vb.textbox txtmessage
height = 1815
left = 0
multiline = -1 'true
tabindex = 7
text = "frmmail.frx":0a1e
tooltiptext = "信件内容"
top = 1680
width = 5775
end
begin vb.label label6
autosize = -1 'true
caption = "用户名"
height = 180
left = 3360
tabindex = 16
top = 840
width = 540
end
begin vb.label statustxt
autosize = -1 'true
backstyle = 0 'transparent
borderstyle = 1 'fixed single
height = 285
left = 960
tabindex = 15
top = 5200
width = 3375
end
begin vb.label label5
autosize = -1 'true
caption = "主题:"
height = 180
left = 240
tabindex = 14
top = 1320
width = 450
end
begin vb.label label4
autosize = -1 'true
caption = "smtp服务器"
height = 180
left = 0
tabindex = 13
top = 960
width = 900
end
begin vb.label label3
autosize = -1 'true
caption = "密码"
height = 180
left = 3360
tabindex = 12
top = 1200
width = 360
end
begin vb.label label2
autosize = -1 'true
caption = "收信人地址"
height = 180
left = 0
tabindex = 11
top = 600
width = 900
end
begin vb.label label1
autosize = -1 'true
caption = "发信人地址"
height = 180
left = 0
tabindex = 10
top = 240
width = 900
end
end
attribute vb_name = "form1"
attribute vb_globalnamespace = false
attribute vb_creatable = false
attribute vb_predeclaredid = true
attribute vb_exposed = false
'程序组合:dapha(汪锋)
'下载http://www.dapha.net
'我是一名vb爱好者,希望得到大家的帮助,共同学习,进步
'转摘请保留以上信息,谢谢合作
private enum smtp_state
mail_connect
mail_helo
mail_from
mail_rcptto
mail_data
mail_dot
mail_quit
mail_user
mail_pass
mail_login
end enum
private m_state as smtp_state
private m_strencodedfiles as string
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器