Home > Software engineering >  Download jmail mail can not download all, save attachment name is not complete
Download jmail mail can not download all, save attachment name is not complete

Time:02-22

Everybody is good!
I can in the new controls, want to write a piece of code is used to download email attachments, but encountered a few problems,
1 mailbox mail more than one thousand, but the download email only 43,
2 download from the download email attachments, find attachment file name can't read properly, can only read the front part of the
3 actually no zhangs attachment due to wrong attachment file read error into the nuptial file,
4 parts accessories lost tut,
5 when charge is more than 1 attachment file name error

The code below
Private Sub Form_load ()
Dim jmail
Dim pop3 As New jmail. Pop3
Dim mailMessage As New jmail. Message
Dim MSG As New jmail. Messages
Dim atts As jmail. Attachments
Dim att As jmail. Attachment
Dim m, n As Integer
The Set of jmail=CreateObject (" jmail. The Message ")
Pop3. Connect "[email protected]", "password", "pop3.163.com"
Pop3. DownloadMessages
'the Response. Write (" You have "& amp; Pop3. Count & amp; "Mails in your mailbox!

" )
The Set att=New jmail. Attachment
If the pop3. Count & gt; 0 Then
For m=1 To pop3 Count
The Set atts=pop3. Messages. The Item (m). Attachments
MailMessage. Charset="GB2312"
MailMessage. Encoding="Base64"
MailMessage. ISOEncodeHeaders=False
Dim strAttName As String
N=0
StrAttName=""
For n=0 To atts. 'Count - 1 attachment
If n & lt;> 0 Then strAttName=strAttName & amp; ", "
The Set att=atts (n)
StrAttName=strAttName & amp; Att. Name
If Dir (App. Path & amp; "\ rar " & amp; StrAttName)="" Then" to determine whether a file exists, if there is deleted after save
Att. SaveToFile (App. Path & amp; "\ rar " & amp; StrAttName)
The Else
Kill the App. The Path & amp; "\ rar " & amp; StrAttName
MsgBox "file exists" & amp; N
Att. SaveToFile (App. Path & amp; "\ rar " & amp; StrAttName)
End the If
The Next n
Next m
The Else
MsgBox "no email"
End the If

End Sub

  • Related