前端之家收集整理的这篇文章主要介绍了
vb邮件功能测试,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
VERSION 5.00
Object = "{20C62CAE-15DA-101B-B9A8-444553540000}#1.1#0"; "MSMAPI32.OCX"
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "Form1"
ClientHeight = 6405
ClientLeft = 45
ClientTop = 330
ClientWidth = 8745
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6405
ScaleWidth = 8745
StartUpPosition = 2 '屏幕中心
Begin VB.ListBox List1
Height = 6180
Left = 0
TabIndex = 2
Top = 0
Width = 7215
End
Begin VB.CommandButton Command2
Caption = "RECEVIED"
Height = 495
Left = 7320
TabIndex = 1
Top = 720
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "SEND"
Height = 495
Left = 7320
TabIndex = 0
Top = 0
Width = 1215
End
Begin MSMAPI.MAPIMessages MAPIMessages1
Left = 7800
Top = 2040
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
AddressEditFieldCount= 1
AddressModifiable= 0 'False
AddressResolveUI= 0 'False
FetchSorted = 0 'False
FetchUnreadOnly = 0 'False
End
Begin MSMAPI.MAPISession MAPISession1
Left = 7800
Top = 1320
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
DownloadMail = 0 'False
logonUI = -1 'True
NewSession = 0 'False
Password = "123456"
UserName = "jeijing.gu"
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
'发送邮件
' Me.MAPISession1.SignOn
With Me.MAPIMessages1
.MsgIndex = -1
.RecipDisplayName = "jeijing.gu@10.33.52.173"
.MsgSubject = "abcdefg"
.MsgNoteText = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
.SessionID = Me.MAPISession1.SessionID
.Send
End With
End Sub
Private Sub Command2_Click()
'接受邮件
Dim i1 As Integer
' Me.MAPISession1.SignOn
Me.MAPIMessages1.SessionID = Me.MAPISession1.SessionID
Me.MAPIMessages1.FetchSorted = True
Me.MAPIMessages1.FetchUnreadOnly = True
Me.MAPIMessages1.Action = 1
Debug.Print Me.MAPIMessages1.MsgCount
Me.List1.Clear
For i1 = 0 To Me.MAPIMessages1.MsgCount - 1
Me.MAPIMessages1.MsgIndex = i1
Me.List1.AddItem Me.MAPIMessages1.MsgSubject
Next i1
End Sub
Private Sub Form_Load()
'
Me.MAPISession1.SignOn
' Me.MAPIMessages1.SessionID = Me.MAPISession1.SessionID
' Me.MAPISession1.SignOn
End Sub
原文链接:https://www.f2er.com/vb/259331.html