bonjour

je souhaite envoyer un mail en vbs en incluant une image qu'accepterais outlook;
En effet, par defaut outlook bloque les images.

j'ai donc trouver une astuce grace à google :


Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
Const CdoReferenceTypeName = 1
Dim objCDO, objBP
Set objCDO = Server.CreateObject("CDO.Message")
objCDO.MimeFormatted = True
objCDO.To = "you@yourdomain.com"
objCDO.From = "you@yourdomain.com"
objCDO.Subject = "Embedded image demo"
objCDO.HTMLBody = "<html>Check this out: <img src=""cid:myimage.gif""></html>"
 
 
' Here's the good part, thanks to some little-known members.
' This is a BodyPart object, which represents a new part of the multipart MIME-formatted message.
' Note you can provide an image of ANY name as the source, and the second parameter essentially
' renames it to anything you want.  Great for giving sensible names to dynamically-generated images.
Set objBP = objCDO.AddRelatedBodyPart(Server.MapPath("/images/myimage.gif"), "myimage.gif", CdoReferenceTypeName)
 
' Now assign a MIME Content ID to the image body part.
' This is the key that was so hard to find, which makes it 
' work in mail readers like Yahoo webmail & others that don't
' recognise the default way Microsoft adds it's part id's,
' leading to "broken" images in those readers.  Note the
' < and > surrounding the arbitrary id string.  This is what
' lets you have SRC="cid:myimage.gif" in the IMG tag.
objBP.Fields.Item("urn:schemas:mailheader:Content-ID") = "<myimage.gif>"
objBP.Fields.Update
 
objCDO.Send
Mais j'ai un message d'erreur sur l'objet server :

erreur : objet requis: 'server'
code 800A01A8

Merci d'avance pour vos aides.