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
| Dim fichiersTrouvé = Directory.GetFiles("D:\Nouveau dossier\Nouveau dossier\", "*.pdf", SearchOption.AllDirectories)
For Each ligneF In fichiersTrouvé
List1.Items.Add(ligneF)
FileClose()
Next
Dim name As String
For i = 0 To List1.Items.Count - 1
Dim filename As String = List1.Items.Item(i)
name = Mid(filename, 39, 8)
Dim Ldap As DirectoryEntry = New DirectoryEntry("serveur", "username", "pwd")
Dim searcher As DirectorySearcher = New DirectorySearcher(Ldap)
searcher.Filter = "mobile=" + name
Dim result As SearchResult = searcher.FindOne()
Dim DirEntry As DirectoryEntry = result.GetDirectoryEntry()
DirEntry = result.GetDirectoryEntry
List2.Items.Add("Email : " + DirEntry.Properties("mail").Value)
Next
Dim client As New System.Net.Mail.SmtpClient
Dim message As New System.Net.Mail.MailMessage
Dim b, c As String
client.UseDefaultCredentials = False
client.Host = "host"
client.Port = 25
client.EnableSsl = False
For Each item In List1.Items
b = List1.Items.IndexOf(item)
c = b
If b = c Then
message.From = New System.Net.Mail.MailAddress("reporting.radio@domaine.com")
message.To.Add(Mid(List2.Items.Item(c).ToString, 9, 30))
Dim item2 As New System.Net.Mail.Attachment(List1.Items.Item(b).ToString)
message.Attachments.Add(item2)
client.Send(message)
message.Attachments.Remove(item2)
message.To.Clear()
message.Subject = "QoS Report"
message.Body = "QoS Report"
End If
Next
For i = 0 To List1.Items.Count - 1
File.Move(List1.Items.Item(i).ToString, "C:\Users\amal.chroudi.stg\Desktop\copie")
Next |
Partager