如何把html作为正文发邮件???
我用vb6的Mapi可以发文本邮件,但是不知道怎么发html邮件,请各位多指教!MAPISession1.LogonUI = True
    MAPISession1.DownLoadMail = False
    MAPISession1.NewSession = True
    
    MAPISession1.SignOn
    MAPIMessages1.SessionID = MAPISession1.SessionID
    
    If txtBody.Text = "" Then txtBody.Text = " "
    Do While Not Rs.EOF
        MAPIMessages1.Compose
        MAPIMessages1.RecipAddress = Rs(1)
        MAPIMessages1.ResolveName
        MAPIMessages1.RecipDisplayName = Rs(0)
        MAPIMessages1.MsgSubject = txtSubject.Text
        MAPIMessages1.MsgNoteText = txtBody.Text
        
        If txtAttach.Text <> "" Then
            MAPIMessages1.AttachmentIndex = 0
            MAPIMessages1.AttachmentPathName = txtAttach.Text
        End If
        'MsgBox MAPIMessages1.MsgCount
        MAPIMessages1.Send
        ConnAccess.Update ("update contacter set isSent=true where conName='" & Rs(0) & "';")
        Rs.MoveNext
        lblStatus.Caption = "×&acute;&Igrave;&not;&pound;&ordm;&Otilde;&yacute;&Ocirc;&Uacute;·&cent;&Euml;&Iacute;&pound;&iexcl;"
    Loop
    MAPISession1.SignOff
    lblStatus.Caption = "×&acute;&Igrave;&not;&pound;&ordm;·&cent;&Euml;&Iacute;&Iacute;ê&sup3;&Eacute;&pound;&iexcl;"
    Exit Sub

解决方案 »

  1.   

    参考:
    http://community.csdn.net/Expert/topic/3209/3209554.xml?temp=.75552
      

  2.   

    看一看:
    This VB6 example program shows how to manually construct and send an HTML mail.' VB source code to create a simple HTML email and send it.
    ' This example manually builds the HTML mail.' (An alternative is to use the Chilkat MHT component in conjunction with
    ' Chilkat Mail to automate the creation of HTML mail from
    ' HTML files or Web pages (URLs).)
    Private Sub Command1_Click()
        
        ' Create a mailman object for sending HTML email
        Dim mailman As ChilkatMailMan2
        Set mailman = New ChilkatMailMan2
        
        mailman.UnlockComponent "Anything works to start 30-day trial"
        
        ' Set the SMTP host.
        mailman.SmtpHost = "smtp.earthlink.net"
        ' Only set the username/password if the SMTP server requires it.
        'mailman.SmtpUsername = "my_username"
        'mailman.SmtpPassword = "my_password"
        
        ' Create the email, add content, address it, and sent it.
        Dim email As ChilkatEmail2
        Set email = New ChilkatEmail2
        email.AddTo "Chilkat Support", "[email protected]"
        email.Subject = "Here is an HTML e-mail with an image"
        
        imageContentID = email.AddRelatedFile("sample.jpg")
        
        email.SetHtmlBody ("<!DOCTYPE HTML PUBLIC " & Chr(34) & _
            "-//W3C//DTD HTML 4.0 Transitional//EN" & Chr(34) & _
            "><HTML><HEAD></HEAD><BODY>" & _
    "<br>This is an example of embedding an image in HTML email.<BR><IMG SRC=" & _
    Chr(34) & "cid:" & imageContentID & Chr(34) & _
    "><br>(The content ID of the image looks like this: " & _
    imageContentID & "<br>The <b>HTML</b> for embedding the image looks like this: &lt;img src=" & _
    Chr(34) & "cid:" & imageContentID & Chr(34) & "&gt;<br></BODY></HTML>")
        
        email.AddPlainTextAlternativeBody "This is the plain text"
        
        email.From = "[email protected]"
            
        'email.SendEncrypted = 1
        ' Call SendEmail to send HTML email.
        success = mailman.SendEmail(email)
        If (success = 1) Then
            Label1.Caption = "Mail Sent!"
        Else
            Label1.Caption = "Error in sending email."
            MsgBox mailman.LastErrorText
        End If
        
        Set email = Nothing
        Set mailman = Nothing
        
    End Sub