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
| Sub EnvoiMail_CDO()
Dim iMsg As Object, iConf As Object, Flds As Object
Set iMsg = CreateObject("cdo.message")
Set iConf = CreateObject("cdo.configuration")
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.aliceadsl.fr" ' ici tu met le serveur corespondant a ton fournisseur d'acces
'la liste tu peut la trouver dans la faq c'est ici!!!='http://outlook.developpez.com/faq/index.php?page=Configuration#Paras_FAI
.Update
End With
With iMsg
Set .Configuration = iConf
.To = "toto@msn.com" 'ici l'adresse du destinataire
.From = "titi@msn.com" 'ici ton adresseemail
.Subject = "titre du message" 'ici le tire
'""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
'mise en forme du paragraphe au format "HTML"
paragraphe = ""
paragraphe = paragraphe & "<HEAD>" & Chr(13)
paragraphe = paragraphe & "<BODY>" & Chr(13)
'************************************
paragraphe = paragraphe & "<BR> Bonjour mr titi <BR>" & vbCrLf
paragraphe = paragraphe & "<BR> attention ceci est une alerte <BR> " & vbCrLf
paragraphe = paragraphe & "<BR>faite attention<BR> " & vbCrLf
paragraphe = paragraphe & "<BR>la maison des trois petit cochon<BR> "
paragraphe = paragraphe & "<BR>va s'ecrouler<BR>" & vbCrLf
paragraphe = paragraphe & "<BR>vous devrier prendre vos jambes a votre coup!!<BR> " & vbCrLf
'***************************************
paragraphe = paragraphe & " Vous souhaitant bonne chance"
paragraphe = paragraphe & "<BR>Cordialement<BR>" & "Mr toto la fritte" & "<BR>" & vbCrLf
paragraphe = paragraphe & "<A href=mailto:l'email de mon entreprise@hotmail.fr>pour toute question Veuillez Cliquez ici pour me contacter</A>"
paragraphe = paragraphe & "</BODY>"
paragraphe = paragraphe & ""
.HTMLBody = paragraphe
'ici on va determiner le fichier a envoyer en piece jointe
.AddAttachment ThisWorkbook.Path & "\TEMP\" & form_mail.PIECE_JOINTE'
.Send
End With
MsgBox "LE DOCUMENT A ETE TRANSMIS "
End Sub |
Partager