Jmail发送邮件问题,发送附件就乱码,不加附件很正常??
鸥之神 2004-05-12 05:56:44 我用jmail发送邮件,如果不发送附件,邮件接收后很正常显示。但是如果有附件,邮件显示后就会乱码,而且是附件内容显示在正文中(乱码显示),但标题去是正常的。
我的源码如下:
Private Function jmailsend() As Boolean
Try
Dim jmail1 As New jmail.Message
jmail1.ContentType = "text/html"
jmail1.Encoding = "base64"
jmail1.Charset = "GB2312"
jmail1.MailServerUserName = MailUserName '用户名
jmail1.MailServerPassWord = MailUserPass '密码
jmail1.From = Me.txtMailAdd.Text '发件人邮件地址
jmail1.Subject = "来自 [" & MailBoxName & "]" & Me.txtName.Text & " 的邮件" '邮件的标题
jmail1.AddRecipient(MailAddress)
jmail1.Body = Me.txtContext.Text '邮件的内容
'附件信息
Dim strAddFileName As String
strAddFileName = UpAddFile()
If strAddFileName <> "" Then
jmail1.AddAttachment(strAddFileName, False, "")
End If
jmail1.Send(MailSMTPServer, False)
jmail1.Close()
jmail1 = Nothing
Return True
Catch ex As Exception
Me.labMess.Text = "错误:" & ex.Message
Return False
End Try
End Function