包括RTF插入的图像将作为HTML在电子邮件中发送

时间:2015-03-05 00:17:03

标签: vb.net

我正在使用此代码将图像插入RTF框中:

Public Sub InsertPicture()
        'Use the code 'InsertPicture()' to show the dialog and insert a picture
        Try
            Dim GetPicture As New OpenFileDialog
            GetPicture.Filter = "PNGs (*.png), Bitmaps (*.bmp), GIFs (*.gif), JPEGs (*.jpg)|*.bmp;*.gif;*.jpg;*.png|PNGs (*.png)|*.png|Bitmaps (*.bmp)|*.bmp|GIFs (*.gif)|*.gif|JPEGs (*.jpg)|*.jpg"
            GetPicture.FilterIndex = 1
            GetPicture.InitialDirectory = "C:\"
            If GetPicture.ShowDialog = Windows.Forms.DialogResult.OK Then
                Dim SelectedPicture As String = GetPicture.FileName
                Dim Picture As Bitmap = New Bitmap(SelectedPicture)
                Dim cboard As Object = Clipboard.GetData(System.Windows.Forms.DataFormats.Text)
                Clipboard.SetImage(Picture)
                Dim PictureFormat As DataFormats.Format = DataFormats.GetFormat(DataFormats.Bitmap)
                If RichTextBoxPrintCtrl1.CanPaste(PictureFormat) Then
                    RichTextBoxPrintCtrl1.Paste(PictureFormat)
                End If
                Clipboard.Clear()
                Clipboard.SetText(cboard)
            End If
        Catch ex As Exception
        End Try
    End Sub

它工作正常,插入/显示图像正常,但是在将RTF转换为HTML并作为HTML电子邮件发送时,图像不会显示。

我猜它是因为它没有将图像作为附件插入,我如何为插入RTF框的每个图像执行此操作?

0 个答案:

没有答案