Dim ds As New DataSet() Dim dtMlSet As DataTable Dim i As Integer Dim j As Integer Dim dr As DataRow Dim msg As jmail.Message Dim strValue(30) As String Dim sReply As String Dim iMailID As Integer Dim sErr As String dtMlSet = GetMlSet(iEmpID) For i = 0 To dtMlSet.Rows.Count - 1 dr = dtMlSet.Rows(i) ' Try Dim pop3 As New jmail.POP3() pop3.Connect(dr(1), DeMailPwd(dr(2)), dr(6), CInt(dr(7))) pop3.DownloadUnreadMessages() For j = 1 To pop3.Count msg = pop3.Messages.Item(j) strValue(0) = Session("empid") strValue(1) = dr(3) strValue(2) = "<img src=../../img/mail/mail" & dr(14).ToString & ".gif>" strValue(3) = 0 strValue(4) = msg.Text strValue(5) = IIf(msg.Subject = "", "无", msg.Subject) Try strValue(6) = ChangeMlSize(msg.Size) strValue(16) = msg.Size Catch strValue(6) = 0 strValue(16) = 0 End Try strValue(7) = GetRe(msg.Recipients, 0) strValue(8) = GetRe(msg.Recipients, 1) strValue(9) = msg.Headers.Text strValue(10) = IIf(msg.FromName = "", msg.From, msg.FromName) strValue(11) = msg.From strValue(12) = msg.Date strValue(13) = msg.Body strValue(14) = msg.HTMLBody sReply = msg.ReplyTo If sReply <> "" Then sReply = Mid(sReply, InStr(sReply, "<") + 1, Len(sReply) - InStr(sReply, "<") - 1) strValue(15) = sReply End If iMailID = SaveToMlMessage(strValue) If msg.Attachments.Count > 0 Then GetAttachments(msg, iMailID) End If '删除邮件 pop3.DeleteSingleMessage(j) Next pop3.Disconnect() ' Catch sErr &= "登录到" & dr(6) & "时出现错误! " ' End Try Next Return sErr
mail.to=string;
mail.from=string;
.....
Dim dtMlSet As DataTable
Dim i As Integer
Dim j As Integer
Dim dr As DataRow
Dim msg As jmail.Message
Dim strValue(30) As String
Dim sReply As String
Dim iMailID As Integer Dim sErr As String dtMlSet = GetMlSet(iEmpID) For i = 0 To dtMlSet.Rows.Count - 1
dr = dtMlSet.Rows(i)
' Try
Dim pop3 As New jmail.POP3()
pop3.Connect(dr(1), DeMailPwd(dr(2)), dr(6), CInt(dr(7)))
pop3.DownloadUnreadMessages() For j = 1 To pop3.Count msg = pop3.Messages.Item(j) strValue(0) = Session("empid")
strValue(1) = dr(3)
strValue(2) = "<img src=../../img/mail/mail" & dr(14).ToString & ".gif>"
strValue(3) = 0
strValue(4) = msg.Text
strValue(5) = IIf(msg.Subject = "", "无", msg.Subject) Try
strValue(6) = ChangeMlSize(msg.Size)
strValue(16) = msg.Size
Catch
strValue(6) = 0
strValue(16) = 0
End Try strValue(7) = GetRe(msg.Recipients, 0)
strValue(8) = GetRe(msg.Recipients, 1)
strValue(9) = msg.Headers.Text
strValue(10) = IIf(msg.FromName = "", msg.From, msg.FromName)
strValue(11) = msg.From
strValue(12) = msg.Date
strValue(13) = msg.Body
strValue(14) = msg.HTMLBody sReply = msg.ReplyTo
If sReply <> "" Then
sReply = Mid(sReply, InStr(sReply, "<") + 1, Len(sReply) - InStr(sReply, "<") - 1)
strValue(15) = sReply
End If iMailID = SaveToMlMessage(strValue) If msg.Attachments.Count > 0 Then
GetAttachments(msg, iMailID)
End If '删除邮件
pop3.DeleteSingleMessage(j)
Next pop3.Disconnect()
' Catch
sErr &= "登录到" & dr(6) & "时出现错误! "
' End Try
Next
Return sErr