利用Jmail接收邮件

来源:互联网 发布:韩语教学软件 编辑:程序博客网 时间:2024/05/16 15:33

Private Sub RecieveMail()
        Dim popMail As jmail.POP3 = New jmail.POP3
        Dim MailMS As jmail.Message
        Dim Atts As jmail.Attachments
        Dim att As jmail.Attachment
        Try
            popMail.Connect('13719073283', '密码', 'pop3.139.com')
            If popMail.Count > 0 Then
                Dim i As Integer
                For i = 1 To popMail.Count
                    '取得一条邮件信息                                                          
                    MailMS = popMail.Messages(i)
                    '取得该邮件的附件集合  
                    Atts = MailMS.Attachments
                    '设置邮件的编码方式()
                    MailMS.Charset = 'GB2312'
                    '设置邮件的附件编码方式                           
                    MailMS.Encoding = 'Base64'
                    '是否将信头编码成iso-8859-1字符集                          
                    MailMS.ISOEncodeHeaders = False
                    MsgBox(MailMS.Subject & vbCr & vbCr & MailMS.Body)
                    Dim j As Integer
                    For j = 0 To Atts.Count - 1
                        att = Atts(j)
                        MsgBox(att.Name)
                        '上传到服务器  
                        att.SaveToFile('d:/' & att.Name)
                    Next
                Next
            Else
                MsgBox('没有新邮件')
            End If


        Catch ex As Exception

        End Try
    End Sub

原创粉丝点击