Re: Lignes d'un fichier texte dans le corps d'un message Outlook
bonsoir Jeff , bonsoir Wilfried
tu peux essayer
Sub EvoiMail_TexteIssuFichierTexte()
'Evoi Mail Sans Message Confirmation
'testé avec XP
'Send using the Pickup directory on the IIS server.
'adapté de : http://support.microsoft.com/default.aspx?kbid=286430
Dim iMsg As Object, iConf As Object
Dim Fichier As String, Cible As String, Resultat As String
Dim Valeur As Long
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Fichier = "C:\Documents and Settings\michel\fichierXLD.txt" 'adapter le chemin
Resultat = ""
Resultat = Resultat & "<HEAD>"
Resultat = Resultat & "<BODY>"
Open Fichier For Input As #1
Do While Not EOF(1)
Line Input #1, Cible 'boucle sur chaque ligne du fichier texte
Resultat = Resultat & Cible & "</br>"
Loop
Resultat = Resultat & "</BODY>"
Resultat = Resultat & ""
With iMsg
Set .Configuration = iConf
.To = "xld@leforum.fr"'adapter l'adresse
'.From = "youralias@yourdomain.com"
.Subject = "test envoi mail"
.HTMLBody = Resultat 'insertion variable texe dans le corps du message
.Send
End With
Close 1 'fermeture fichier texte
End Sub
bonne soiree
MichelXld