如何用MAPI與CDONTS來發(fā)郵件
發(fā)表時(shí)間:2024-06-10 來源:明輝站整理相關(guān)軟件相關(guān)文章人氣:
[摘要]不想另外安裝第三方的發(fā)郵件組件,想直接利用MS的。請問在VB里如何用MAPI來發(fā)送郵件(好像MAPI是OUTLOOK和OE自帶有的吧),需要像在OE里發(fā)郵件一樣先手工設(shè)置好發(fā)信帳號嗎?能不能像JMAIL一樣在發(fā)信時(shí)指定SMTP服務(wù)器及發(fā)信驗(yàn)證用戶名和密碼?哪里有CDONTS發(fā)郵件的源碼?我需要能指...
不想另外安裝第三方的發(fā)郵件組件,想直接利用MS的。
請問在VB里如何用MAPI來發(fā)送郵件(好像MAPI是OUTLOOK和OE自帶有的吧),需要像在OE里發(fā)郵件一樣先手工設(shè)置好發(fā)信帳號嗎?能不能像JMAIL一樣在發(fā)信時(shí)指定SMTP服務(wù)器及發(fā)信驗(yàn)證用戶名和密碼?
哪里有CDONTS發(fā)郵件的源碼?我需要能指定發(fā)郵件的SMTP及認(rèn)證用戶名和密碼的那個(gè)版本的,這就相當(dāng)于JMAIL能實(shí)現(xiàn)的功能了,好像低版本的CDO不支持,汗~~~~~
下面是使用winsock實(shí)現(xiàn)的發(fā)送郵件,但其它問題仍未解決,等待高手
eSTMP.vbp
-------------------------------------------
Type=Exe
Object={248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0; MSWINSCK.OCX
Form=frmmail.frm
Startup="Form1"
HelpFile=""
Title="Email發(fā)送"
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發(fā)送,支持服務(wù)器認(rèn)證,超文本郵件內(nèi)容"
VersionLegalCopyright="Copyright 2002 dapha.net"
VersionProductName="Email發(fā)送軟件"
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 = "郵件發(fā)送程序(支持smtp服務(wù)器驗(yàn)證)"
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 = "這里為超文本信件內(nèi)容"
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 = "發(fā)送"
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 = "信件內(nèi)容"
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服務(wù)器"
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 = "發(fā)信人地址"
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愛好者,希望得到大家的幫助,共同學(xué)習(xí),進(jìn)步
'轉(zhuǎn)摘請保留以上信息,謝謝合作
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
[1] [2] 下一頁