用mapi发送邮件怎么样抄送给另外的人?? 急

yylituo 2004-12-06 08:06:18
源代码如下:
Private Sub SendEmail(ByVal EmailAddress As String, ByVal Subject As String, ByVal NoteText As String, ByVal FilePath As String)
If EmailAddress = "" Then Exit Sub
On Error GoTo ErrMail
MAPISession1.LogonUI = False
MAPISession1.DownLoadMail = False
MAPISession1.SignOn
MAPIMessages1.SessionID = MAPISession1.SessionID
MAPIMessages1.Compose
MAPIMessages1.RecipAddress = EmailAddress
MAPIMessages1.MsgSubject = Subject
MAPIMessages1.MsgNoteText = NoteText
'Add the Attachment at the end of the message
MAPIMessages1.AttachmentPosition = Len(MAPIMessages1.MsgNoteText)
'Set the type to a data file
MAPIMessages1.AttachmentType = mapData
'Give it a name
'MAPIMessages1.AttachmentName = txtAttachmentName.Text
'Specify what file to send
MAPIMessages1.AttachmentPathName = FilePath
MAPIMessages1.Send False 'false means do not show the composition window
ErrMail:
If MAPISession1.SessionID <> 0 Then MAPISession1.SignOff
If Err.Number <> 0 Then Err.Raise Err.Number, Err.Source, Err.Description
End Sub
...全文
159 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
zgvslch 2004-12-07
  • 打赏
  • 举报
回复
Private Sub SendEmail(ByVal EmailAddress As String, ByVal Subject As String, ByVal NoteText As String, ByVal FilePath As String)
dim emailArr() as string
If EmailAddress = "" Then Exit Sub
emailArr = spilt(EmailAddress,"#")
for i = 0 to ubound(eamilArr)

On Error GoTo ErrMail
MAPISession1.LogonUI = False
MAPISession1.DownLoadMail = False
MAPISession1.SignOn
MAPIMessages1.SessionID = MAPISession1.SessionID
MAPIMessages1.Compose
MAPIMessages1.RecipAddress = eamilArr(i)'*****************
MAPIMessages1.MsgSubject = Subject
MAPIMessages1.MsgNoteText = NoteText
'Add the Attachment at the end of the message
MAPIMessages1.AttachmentPosition = Len(MAPIMessages1.MsgNoteText)
'Set the type to a data file
MAPIMessages1.AttachmentType = mapData
'Give it a name
'MAPIMessages1.AttachmentName = txtAttachmentName.Text
'Specify what file to send
MAPIMessages1.AttachmentPathName = FilePath
MAPIMessages1.Send False 'false means do not show the composition window
ErrMail:
If MAPISession1.SessionID <> 0 Then MAPISession1.SignOff
If Err.Number <> 0 Then Err.Raise Err.Number, Err.Source, Err.Description
End Sub
调用的时候住地址和抄送地址用#号连接起来
yylituo 2004-12-07
  • 打赏
  • 举报
回复
没有人知道吗?
yylituo 2004-12-07
  • 打赏
  • 举报
回复
自己搞定了!!! 不过还是谢谢大家
MAPISession1.LogonUI = False
MAPISession1.DownLoadMail = False
MAPISession1.SignOn
MAPIMessages1.SessionID = MAPISession1.SessionID
MAPIMessages1.Compose
MAPIMessages1.RecipIndex = 0
MAPIMessages1.RecipAddress = "A@126.com"
MAPIMessages1.RecipIndex = 1
MAPIMessages1.RecipAddress = "B@126.com"
MAPIMessages1.MsgIndex = -1
MAPIMessages1.RecipType = 2
MAPIMessages1.MsgSubject = Subject
MAPIMessages1.MsgNoteText = NoteText
MAPIMessages1.Send False 'false means do not show the composition window
If MAPISession1.SessionID <> 0 Then MAPISession1.SignOff
yylituo 2004-12-07
  • 打赏
  • 举报
回复
zgvslch(烟花离落) :
好像还是不行阿!
比如我要发送给 A@126.com,同时抄送这封信给 B@126.com !应该怎么改写
yylituo 2004-12-06
  • 打赏
  • 举报
回复
要一次发送,不能发送两次!
zgvslch 2004-12-06
  • 打赏
  • 举报
回复
改变地址EmailAddress ,执行两次

1,502

社区成员

发帖
与我相关
我的任务
社区描述
VB 网络编程
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧