Hi everyone,
I need a help. I've been in many many forums looking for help but not satisfied.
Here is my trouble :
I want to send multiple email to multiple addresses located in my database. My database has an attachment field that I want to send directly to each line of the database.
Can someone can help me? I use IBM Lotus Notes.
Here is the code I use, but it doesn't want to take attachment from my database.
I need a help. I've been in many many forums looking for help but not satisfied.
Here is my trouble :
I want to send multiple email to multiple addresses located in my database. My database has an attachment field that I want to send directly to each line of the database.
Can someone can help me? I use IBM Lotus Notes.
Here is the code I use, but it doesn't want to take attachment from my database.
Code:
'Sending e-mail to manager
Private Sub Commande219_Click()
'Variable
Dim rst As DAO.Recordset
Dim strSQL As String
Dim strMessageType As String
Dim strTitre As String
Dim strMsg As String
' Titre du message
strTitre = "{Objet} -- Résolu" _
' Message to send
' Les signes {...} seront remplacés plus loin par
' les infos Client
strMessageType = "Bonjour," _
& vbCrLf & vbCrLf _
& "En date du {Date}, Nous avons reçu du client {Nom_Client} la réclamation en objet." & vbCrLf & vbCrLf _
& "Nous vous écrivons pour vous informer que cela a été pris en compte et désormais clôt." & vbCrLf _
& vbCrLf & "Nous vous souhaitons une bonne réception" _
& vbCrLf & vbCrLf & "~~ Service de Réclamations - UGB ~~"
' Open the querry
' (seuls les gestionnaire ayant un email sont concernés ici)
strSQL = " SELECT * FROM [Reclamations] WHERE (((Reclamations.Etat)='Clôturée')) "
Set rst = CurrentDb.OpenRecordset(strSQL, dbOpenSnapshot)
' Browse the client list
While Not rst.EOF
' Construire un message personnalisé
' (on remplace chaque {...} du message par les champs
' équivalents de la requête
strMsg = Replace(strMessageType, "{Nom_Client}", rst("Nom_Client"))
strMsg = Replace(strMsg, "{Date}", rst("Date"))
strTitre = Replace(strTitre, "{Objet}", rst("Objet"))
'Send the e-mail
SendMail rst("E-mail_gest"), strTitre, strMsg, False
' Next client
rst.MoveNext
Wend
' One empty ressources
rst.Close
Set rst = Nothing
CurrentDb.Execute ("UPDATE Reclamations SET Reclamations.Etat = 'Archivée' WHERE (((Reclamations.Etat) = 'Clôturée')) ")
' A bit message of confirmation
MsgBox "E-mail de clôture envoyé aux gestionnaires!", vbInformation, "UGB -- Service de Réclamations"
End Sub
Comment