对不起,我是说用vb程序outlook对象。 objOutlookMsg.HTMLBody = "<HTML><H2>My HTML page.</H2></HTML>" 如果网页里面有图片怎么办? 另外加附件如何做?
Option Explicit Dim lPosition As Long Dim newemial As BooleanPrivate Sub Form_Load() MAPISession1.SignOn MAPIMessages1.SessionID = MAPISession1.SessionID MAPIMessages1.Fetch If MAPIMessages1.MsgCount > 0 Then Txtfrom.Text = MAPIMessages1.MsgOrigDisplayName Txtto.Text = MAPIMessages1.RecipDisplayName Txtsubject.Text = MAPIMessages1.MsgSubject Txtmessage.Text = MAPIMessages1.MsgNoteText Cmdback.Enabled = True Cmdforward.Enabled = True Cmdsend.Enabled = True txtcount.Text = CStr(MAPIMessages1.MsgCount) Txtindex.Text = CStr(MAPIMessages1.MsgIndex + 1) Else MsgBox "You have no messages?" MAPISession1.SignOff Cmdback.Enabled = False Cmdforward.Enabled = False Cmdsend.Enabled = False End If End SubPrivate Sub Cmdfj1_Click() Cmdg.Filter = "all(*.*)" Cmdg.ShowOpen Txtfj1.Text = Cmdg.FileName End SubPrivate Sub Cmdfj2_Click() Cmdg.Filter = "all(*.*)" Cmdg.ShowOpen Txtfj2.Text = Cmdg.FileName End SubPrivate Sub Cmdnew_Click() MAPISession1.SignOff Txtfrom.Text = "" Txtto.Text = "" Txtsubject.Text = "" Txtmessage.Text = "" Txtfj1.Text = "" Txtfj2.Text = "" MAPISession1.SignOn MAPISession1.NewSession = True newemial = True Txtto.SetFocus End SubPrivate Sub Cmddelete_Click() If Txtto.Text = "" Then Exit Sub Dim xx As Integer xx = MsgBox("确认删除当前邮件?", vbYesNo + vbInformation, "提示") If xx = vbYes Then MAPIMessages1.Delete MAPISession1.SignOff lPosition = 0 Form_Load End If End SubPrivate Sub cmdForward_Click() If lPosition < MAPIMessages1.MsgCount - 1 Then lPosition = lPosition + 1 MAPIMessages1.MsgIndex = lPosition Txtfrom.Text = MAPIMessages1.MsgOrigDisplayName Txtto.Text = MAPIMessages1.RecipDisplayName Txtsubject.Text = MAPIMessages1.MsgSubject Txtmessage.Text = MAPIMessages1.MsgNoteText Txtfj1.Text = MAPIMessages1.AttachmentName Txtindex.Text = CStr(MAPIMessages1.MsgIndex + 1) If Not Cmddelete.Enabled Then Cmddelete.Enabled = True newemial = False End If End Sub Private Sub cmdBack_Click() If lPosition > 0 Then lPosition = lPosition - 1 MAPIMessages1.MsgIndex = lPosition Txtfrom.Text = MAPIMessages1.MsgOrigDisplayName Txtto.Text = MAPIMessages1.RecipDisplayName Txtsubject.Text = MAPIMessages1.MsgSubject Txtmessage.Text = MAPIMessages1.MsgNoteText Txtfj1.Text = MAPIMessages1.AttachmentPosition Txtindex.Text = CStr(MAPIMessages1.MsgIndex + 1) If Not Cmddelete.Enabled Then Cmddelete.Enabled = True newemial = False End If End SubPrivate Sub cmdSend_Click() If Txtto.Text = "" Or Txtmessage.Text = "" Then Call MsgBox("请输入收件人信息及邮件内容!", vbOKOnly, "提示") Cmdsend.Enabled = False Exit Sub End If MAPIMessages1.Compose MAPIMessages1.RecipDisplayName = Txtto.Text MAPIMessages1.MsgSubject = Txtsubject.Text MAPIMessages1.MsgNoteText = Txtmessage.Text If Txtfj1.Text <> "" Then MAPIMessages1.AttachmentIndex = 0 MAPIMessages1.AttachmentPathName = Trim(Txtfj1.Text) End If If Txtfj2.Text <> "" Then If MAPIMessages1.AttachmentCount = 0 Then MAPIMessages1.AttachmentIndex = 0 Else MAPIMessages1.AttachmentIndex = 1 End If MAPIMessages1.AttachmentPathName = Trim(Txtfj2.Text) End If MAPIMessages1.ResolveName MAPIMessages1.Send newemial = False End SubPrivate Sub cmdClose_Click() MAPISession1.SignOff Unload Me End Sub Private Sub Form_Resize() Txtmessage.Height = Me.Height - 3660 Txtmessage.Width = Me.Width - 450 Cmdclose.Left = Me.Width - 1500 End SubPrivate Sub Txtto_GotFocus() If newemial Then Cmdsend.Enabled = True End Sub
objOutlookMsg.HTMLBody = "<HTML><H2>My HTML page.</H2></HTML>"
如果网页里面有图片怎么办?
另外加附件如何做?
Dim lPosition As Long
Dim newemial As BooleanPrivate Sub Form_Load()
MAPISession1.SignOn
MAPIMessages1.SessionID = MAPISession1.SessionID
MAPIMessages1.Fetch
If MAPIMessages1.MsgCount > 0 Then
Txtfrom.Text = MAPIMessages1.MsgOrigDisplayName
Txtto.Text = MAPIMessages1.RecipDisplayName
Txtsubject.Text = MAPIMessages1.MsgSubject
Txtmessage.Text = MAPIMessages1.MsgNoteText
Cmdback.Enabled = True
Cmdforward.Enabled = True
Cmdsend.Enabled = True
txtcount.Text = CStr(MAPIMessages1.MsgCount)
Txtindex.Text = CStr(MAPIMessages1.MsgIndex + 1)
Else
MsgBox "You have no messages?"
MAPISession1.SignOff
Cmdback.Enabled = False
Cmdforward.Enabled = False
Cmdsend.Enabled = False
End If
End SubPrivate Sub Cmdfj1_Click()
Cmdg.Filter = "all(*.*)"
Cmdg.ShowOpen
Txtfj1.Text = Cmdg.FileName
End SubPrivate Sub Cmdfj2_Click()
Cmdg.Filter = "all(*.*)"
Cmdg.ShowOpen
Txtfj2.Text = Cmdg.FileName
End SubPrivate Sub Cmdnew_Click()
MAPISession1.SignOff
Txtfrom.Text = ""
Txtto.Text = ""
Txtsubject.Text = ""
Txtmessage.Text = ""
Txtfj1.Text = ""
Txtfj2.Text = ""
MAPISession1.SignOn
MAPISession1.NewSession = True
newemial = True
Txtto.SetFocus
End SubPrivate Sub Cmddelete_Click()
If Txtto.Text = "" Then Exit Sub
Dim xx As Integer
xx = MsgBox("确认删除当前邮件?", vbYesNo + vbInformation, "提示")
If xx = vbYes Then
MAPIMessages1.Delete
MAPISession1.SignOff
lPosition = 0
Form_Load
End If
End SubPrivate Sub cmdForward_Click()
If lPosition < MAPIMessages1.MsgCount - 1 Then
lPosition = lPosition + 1
MAPIMessages1.MsgIndex = lPosition
Txtfrom.Text = MAPIMessages1.MsgOrigDisplayName
Txtto.Text = MAPIMessages1.RecipDisplayName
Txtsubject.Text = MAPIMessages1.MsgSubject
Txtmessage.Text = MAPIMessages1.MsgNoteText
Txtfj1.Text = MAPIMessages1.AttachmentName
Txtindex.Text = CStr(MAPIMessages1.MsgIndex + 1)
If Not Cmddelete.Enabled Then Cmddelete.Enabled = True
newemial = False
End If
End Sub
Private Sub cmdBack_Click()
If lPosition > 0 Then
lPosition = lPosition - 1
MAPIMessages1.MsgIndex = lPosition
Txtfrom.Text = MAPIMessages1.MsgOrigDisplayName
Txtto.Text = MAPIMessages1.RecipDisplayName
Txtsubject.Text = MAPIMessages1.MsgSubject
Txtmessage.Text = MAPIMessages1.MsgNoteText
Txtfj1.Text = MAPIMessages1.AttachmentPosition
Txtindex.Text = CStr(MAPIMessages1.MsgIndex + 1)
If Not Cmddelete.Enabled Then Cmddelete.Enabled = True
newemial = False
End If
End SubPrivate Sub cmdSend_Click()
If Txtto.Text = "" Or Txtmessage.Text = "" Then
Call MsgBox("请输入收件人信息及邮件内容!", vbOKOnly, "提示")
Cmdsend.Enabled = False
Exit Sub
End If
MAPIMessages1.Compose
MAPIMessages1.RecipDisplayName = Txtto.Text
MAPIMessages1.MsgSubject = Txtsubject.Text
MAPIMessages1.MsgNoteText = Txtmessage.Text
If Txtfj1.Text <> "" Then
MAPIMessages1.AttachmentIndex = 0
MAPIMessages1.AttachmentPathName = Trim(Txtfj1.Text)
End If
If Txtfj2.Text <> "" Then
If MAPIMessages1.AttachmentCount = 0 Then
MAPIMessages1.AttachmentIndex = 0
Else
MAPIMessages1.AttachmentIndex = 1
End If
MAPIMessages1.AttachmentPathName = Trim(Txtfj2.Text)
End If
MAPIMessages1.ResolveName
MAPIMessages1.Send
newemial = False
End SubPrivate Sub cmdClose_Click()
MAPISession1.SignOff
Unload Me
End Sub
Private Sub Form_Resize()
Txtmessage.Height = Me.Height - 3660
Txtmessage.Width = Me.Width - 450
Cmdclose.Left = Me.Width - 1500
End SubPrivate Sub Txtto_GotFocus()
If newemial Then Cmdsend.Enabled = True
End Sub
先给分,再求解,我会继续加分。
谢谢大家
尤其是wzsswz(岌岌荆棘)谢谢你的解答。