1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
Private Sub ReceptionSMTP(ByRef rsReceptions As ADODB.Recordset)
Dim SizeEmailIN As Long
Dim TotalSizeEmailIN As Long
Dim pop As NYEMailLib.NYEMPop
Dim strMailFile As String
Dim nbEmail As Long
Static savPopServer As String
Static savPopUser As String
On Error GoTo ErrSMTPOUT
With rsReceptions
If (savPopServer <> !PopServer) Or (savPopUser <> !PopUser) Then
savPopServer = !PopServer
savPopUser = !PopUser
Set pop = New NYEMailLib.NYEMPop
pop.Open !PopServer
pop.Logon !PopUser, !PopPassword
CreateDirIfNotExistsWithVerif !DirFileRec
TotalSizeEmailIN = pop.TotalSize
For nbEmail = 0 To pop.NbMsg - 1
strMailFile = CreateTempFile(!DirFileRec, "SMTP", "eml")
AddMessageETTextEmailReport "*Récept SMTP " + !PopUser + " -> " + strMailFile
pop.RetrieveFile nbEmail, strMailFile
SizeEmailIN = pop.MsgSize(nbEmail)
'' If WithNotary Then
'' Notary.Notarize strMailFile, !NomPartenaireIN + ":" + !PopUser, !PopServer, nyReception, " (" + CStr(SizeEmailIN) + " oct.)"
'' End If
pop.Delete nbEmail
Next nbEmail
ErrSMTPOUT:
If Err.Number <> 0 Then
If WithNotary Then
Dim strStep As String
strStep = "Recept. SMTP"
Select Case Err.Number
Case NYEMailLib.nyemPopErrorCanNotConnectToServer
Notary.AddTrace nyerror, Err.Number, "[" + Err.Source + "] " + "Impossible de se connecter au serveur POP", strStep
Case NYEMailLib.nyemPopErrorInvalidPassword
Notary.AddTrace nyerror, Err.Number, "[" + Err.Source + "] " + "Nom et/ou Mot de passe de connexion au serveur POP invalide", strStep
Case NYEMailLib.nyemPopErrorInvalidUser
Notary.AddTrace nyerror, Err.Number, "[" + Err.Source + "] " + "Nom de connexion au serveur POP invalide", strStep
Case NYEMailLib.nyemPopErrorServerAddressNotFound
Notary.AddTrace nyerror, Err.Number, "[" + Err.Source + "] " + "Impossible de trouver l'adresse du serveur POP", strStep
Case Else
Notary.AddTrace nyerror, Err.Number, "[" + Err.Source + "] " + Err.Description, strStep
End Select
End If
End If
Err.Clear
On Error Resume Next
pop.Quit
Set pop = Nothing
End If
End With
End Sub |
Partager