With MAPIMessages1
.MsgIndex = -1
.RecipDisplayName = "[email protected]"
.MsgSubject = "jonia"
.MsgNoteText = "junny"
.SessionID = MAPISession1.SessionID
.AttachmentName = "8092.rar"
.AttachmentPathName = "f:\8092.rar"
.Send
End With问题1: 这段程序执行的时候,每发一封邮件就确定一下,能不能不用确定,自动发
问题2: 怎么加暗抄(抄送)功能!!!
问题3: 怎么知道邮件发送有没有成功,有没有返回值来判断阿!!!!
.MsgIndex = -1
.RecipDisplayName = "[email protected]"
.MsgSubject = "jonia"
.MsgNoteText = "junny"
.SessionID = MAPISession1.SessionID
.AttachmentName = "8092.rar"
.AttachmentPathName = "f:\8092.rar"
.Send
End With问题1: 这段程序执行的时候,每发一封邮件就确定一下,能不能不用确定,自动发
问题2: 怎么加暗抄(抄送)功能!!!
问题3: 怎么知道邮件发送有没有成功,有没有返回值来判断阿!!!!
MAPISession1.UserName = "MICROSOFT OUTLOOK"
MAPISession1.SignOn
MAPIMessages.SessionID = MAPISession1.SessionID
MAPIMessages.Compose
MAPIMessages.RecipDisplayName = "Test User"
MAPIMessages.RecipAddress = "[email protected]"
MAPIMessages.ResolveName
MAPIMessages.RecipType = 3 '<***** This is Bcc *******
MAPIMessages.MsgSubject = "test!"
'Create the message
MAPIMessages.MsgNoteText = strEmailMessage
MAPIMessages.Send False
MAPISession1.SignOffThe 3 is "Bcc"
2 is "cc"
1 is "To"
Public Sub MAPIOpen() 'Monitor logon errors
On Error GoTo lblNoSignon 'Open and assign the MAPI session
With MAPISession
.UserName = "User"
.Password = "Password"
.SignOn
MAPIMessages.SessionID = .SessionID
End With'Exit sub
Exit Sub'Monitor logon errors
lblNoSignon:
On Error GoTo 0
MsgBox "Could not open the MAPI session with user '" & GetSetting(App.Title, "Options", "User", "") & "'", vbCritical + vbOKOnly, "MAPI Error"
End SubPrivate Function MessageSend(DisplayName As String, Address As String, _
Bcc As String, Subject As String, NoteText As String) As Boolean 'Monitor send errors
On Error GoTo lblNoSend'Compose a new message
MAPIMessages.Compose 'Address the message
MAPIMessages.RecipIndex = 0
MAPIMessages.RecipType = mapToList
MAPIMessages.RecipDisplayName = DisplayName
MAPIMessages.RecipAddress = Address
'Bcc the message
If Bcc <> "" Then
MAPIMessages.RecipIndex = 1
MAPIMessages.RecipType = mapBccList
MAPIMessages.RecipDisplayName = App.Title
MAPIMessages.RecipAddress = Bcc
End If
'Create the message
MAPIMessages.MsgSubject = Subject
MAPIMessages.MsgNoteText = NoteText 'Send the message
MAPIMessages.Send False'Return success
MessageSend = True
Exit Function'Monitor send errors
lblNoSend:
On Error GoTo 0
End Function