XL 2016 Cdo message , image arriere plan

titim77

XLDnaute Nouveau
bonjour
j'arrive à inserer une image dans un mail et ca fonctionne tres bien
par contre impossible de coller une image en arriere plan dans mon tableau
j'utilise du CSS

corps = corps & "<style type='text/css'>"
corps = corps & ".blog-author-image {"
corps = corps & " position: absolute;"
corps = corps & " top: 100px;"
corps = corps & " left: 200px;"
corps = corps & " opacity:0.1;"
corps = corps & "}"
corps = corps & " </style>"

mon tableau fait ICI

corps = corps & " <div><img class='blog-author-image' src='cid:logo lounge.jpg'>"
corps = corps & "</div>"

myMail.HTMLBody = corps

Set objBP = myMail.AddRelatedBodyPart(Server.MapPath("images/logos/logo lounge.jpg"), "logo lounge.jpg", 1)
objBP.Fields.Item("urn:schemas:mailheader:Content-ID") = "<logo lounge.jpg>"
objBP.Fields.Update

et le resultat est différent de l'attendu
d'une part la transparence ne fonctionne pas
mais en plus le logo est ajouté apres le tableau
avez vous une idee pour mettre ce logo en arriere plan du message ?
 

titim77

XLDnaute Nouveau
Bonjour @titim77

Une piste en passant :


@Phil69970
bonjour j'y ai pensé mais la il faut une url donc le AddRelatedBodyPart du coup n'est pas fonctionnel de plus si l'image est dans un intranet ==> envoi mail à une personne exterieure à l'entreprise l'image ne sera pas disponible
 

patricktoulon

XLDnaute Barbatruc
re
Bonjour

oulà!!!
AddRelatedBodyPart
l'url c'est le lien de l'image dans le mail lui même il te faut les créer
et les balise style sont directement éliminées dans la lecture du body chez le destinataire et cela quasiment sur toute les app mail
le style de l'image doit être inline!!!
;)
 

titim77

XLDnaute Nouveau
re
Bonjour

oulà!!!
AddRelatedBodyPart
l'url c'est le lien de l'image dans le mail lui même il te faut les créer
et les balise style sont directement éliminées dans la lecture du body chez le destinataire et cela quasiment sur toute les app mail
le style de l'image doit être inline!!!
;)
dans mon css j'ai 3 styles differents
corps = corps & "<style type='text/css'>"
corps = corps & " .matable{"
corps = corps & " border: 2px solid darkblue;"
corps = corps & " border-collapse: collapse;"
corps = corps & " padding: 10px;"
corps = corps & " width: 550px"
corps = corps & " }"
corps = corps & " .col{"
corps = corps & " font-family:Arial, Helvetica, sans-serif;"
corps = corps & " font-size:14px;"

corps = corps & " }"
corps = corps & ".blog-author-image {"
corps = corps & " position: absolute;"
corps = corps & " top: 100px;"
corps = corps & " left: 200px;"
corps = corps & " opacity:0.1;"
corps = corps & "}"
corps = corps & " </style>"

seul le dernier ne fonctionne pas
 

patricktoulon

XLDnaute Barbatruc
c'est la même chose mais dans le outertext de l’élément et sans les accolades
la classe n'est plus nécessaire puisque inline
HTML:
<img  style=' position:absolute;left:100;top:100;opacity:0.1;'src='cid:logo lounge.jpg'/>"

quand a opacité regarde si ça ne serait pas plutôt une virgule que le point
et enlève les "<>" dans la création des cid !!!!!!!
 

titim77

XLDnaute Nouveau
helas ca a fait exactement la meme chose :(
l'image se colle apres le tableau
ensuite pour l'opacité si ca ne fonctionne pas je peux creer l'image avec tune transparence
1648214826385.png
 

patricktoulon

XLDnaute Barbatruc
re
si on voit pas le reste du code html produit ça va être difficile de t'aider
l'image elle sert de fond transparent a quoi
a tu penser a utiliser plutôt le propertie background et transparency
bref sans code ni fichier tu va ramer longtemps
travailler en aveugle c'est pas mon fort ;)
 

titim77

XLDnaute Nouveau
bonjour
Voici mon code
a noter que toutes les images sont bien presentes et à l'edroi souhaitee
seule mon image en arriere plan que je souhaite ne l'et pas , elle se positionne apres le tableau
et l'opacité n'a pas l'ai de fonctionner mais si c'est que ca , c'est pas important




Dim myMail
Dim cdoConfiguration

Set myMail = CreateObject("CDO.Message")
Set cdoConfiguration = CreateObject("CDO.Configuration")

cdoConfiguration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
cdoConfiguration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "serveur"
cdoConfiguration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
cdoConfiguration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
cdoConfiguration.Fields.Update
Set myMail.Configuration = cdoConfiguration


Theme = ateliers("nom_theme")

Select Case Theme

Case "Teams"
imgdyn = "teams.png"
Case "KeePass"
imgdyn = "keepass.png"
Case "Excel"
imgdyn = "excel.png"
Case "Word"
imgdyn = "word.png"
Case "Outlook"
imgdyn = "outlook.png"
Case "PowerPoint"
imgdyn = "powerpoint.png"
Case "Power BI"
imgdyn = "powerbi.png"
Case "Sharepoint"
imgdyn = "sharepoint.png"
Case "OneNote"
imgdyn = "onenote.png"
Case "Windows"
imgdyn = "windows.png"
Case "Téléphonie mobile"
imgdyn = "telephonie.png"
Case Else
imgdyn = "blank.png"
End Select


logo ="<div style='text-align: left;'><img src='cid:logo lounge.jpg' width='50'><br></div>"

logoshift ="<div style='text-align: left;'><img src='cid:logo lounge.jpg' width='50'>&nbsp;&nbsp;"
logoshift = logoshift & "<img src='cid:logo_shift.png' width='100'>"
logoshift = logoshift & "<br></div>"

annule="<a href='http://lounge/desinscription.asp?ia="& id_atelier & "&mail=" & request.Form("mail") & "'>"
annule= annule &"<img src='cid:delete.png' width='100'>"
annule= annule &"</a>"

footer="<div style='font-family:Arial, Helvetica, sans-serif;font-size:10px;'>"
footer=footer &"<i>En cas d’incident, veuillez contacter le Help Desk<br />"
footer=footer & "Afin d’évaluer la qualité des services du Lounge IT, nous vous informons que vous pourriez prochainement être sollicités pour répondre à une enquête de satisfaction"
footer=footer & "</i></div>"

Nom_atelier= ateliers("nom_atelier")

colinstr = InStr(1, Nom_atelier, "]")
If colinstr > 0 Then
libatelier = Mid(Nom_atelier, colinstr + 1, Len(Nom_atelier) - (colinstr - 1))
libatelier = replace(libatelier,chr(10)," ")
libatelier = replace(libatelier,chr(13)," ")
libatelier = replace(libatelier,"<br/>"," ")
libatelier = replace(libatelier,"<br>"," ")
libatelier = replace(libatelier,"</h4>","")
libatelier = replace(libatelier,"</div>","")
libatelier = replace(libatelier,"<b>","")
libatelier = replace(libatelier,"</b>","")

End If

CorpsShift="<table style='padding: 20px; width: 500px'>"
CorpsShift= CorpsShift & "<tr>"
CorpsShift= CorpsShift & "<td colspan='2'><img src='cid:shift_embrace.png'></td>"
CorpsShift= CorpsShift & "</tr>"
CorpsShift= CorpsShift & "<tr>"
CorpsShift= CorpsShift & "<td colspan='2' style='font-family:Arial, Helvetica, sans-serif;font-size:14px;'>"
CorpsShift= CorpsShift & "<b>Atelier</b> : " & libatelier & "<br/>"
CorpsShift= CorpsShift & "<b>Date</b> : "
CorpsShift= CorpsShift & ateliers("date_atelier") & " de " & FormatDateTime (ateliers("heure_debut_atelier"),4)
CorpsShift= CorpsShift & " à "&FormatDateTime (ateliers("heure_fin_atelier"),4) & "<br />"
CorpsShift= CorpsShift & "<b>Site</b> : " & ateliers("site_atelier") & "<br/>"
CorpsShift= CorpsShift & "<b>Salle</b> : " & ateliers("salle")
CorpsShift= CorpsShift & "</td>"
CorpsShift= CorpsShift & "</tr>"
CorpsShift= CorpsShift & "<tr>"
CorpsShift= CorpsShift & "<td>"
CorpsShift= CorpsShift & "<table border='0' width='100%'>"
CorpsShift= CorpsShift & "<tr>"
CorpsShift= CorpsShift & "<td width='25%'><img src='cid:shift_left.png'></td>"
CorpsShift= CorpsShift & "<td style='font-family:Arial, Helvetica, sans-serif;font-size:14px;text-align:right'><p>Bonjour " & request.Form("prenom") & ",</p>"
CorpsShift= CorpsShift & "<p>Vous venez de vous inscrire à une des sessions<br/>de formation des outils Microsoft 365 (Teams,<br/> OneDrive et Yammer).</p>"
CorpsShift= CorpsShift & "<p>Votre parcours de formation comprend 4<br/> sessions d’1 heure.</p>"
CorpsShift= CorpsShift & "<p>Vous recevrez un lien Teams avant le début de<br/> votre formation.</p>"
CorpsShift= CorpsShift & "<p>Avant de participer à l’un des ateliers, merci<br/>d’installer Teams sur votre poste de travail.</p>"
CorpsShift= CorpsShift & "<p>A bientôt sur Teams !</p>"
CorpsShift= CorpsShift & "</td>"
CorpsShift= CorpsShift & "</tr>"
CorpsShift= CorpsShift & "</table>"
CorpsShift= CorpsShift & "</td>"
CorpsShift= CorpsShift & "</tr>"
CorpsShift= CorpsShift & "</table>"
CorpsShift= CorpsShift & "<table style='padding: 20px; width: 1000px'>"
CorpsShift= CorpsShift & "<tr><td width='5%'></td><td>"
CorpsShift= CorpsShift & "<div style='font-family:Arial, Helvetica, sans-serif;font-size:14px;'>"
CorpsShift= CorpsShift & "En cas d'empêchement merci de vous désinscrire de<br/>l'atelier en cliquant sur le le bouton suivant</div>"
CorpsShift= CorpsShift & "<br/>" & annule &"<br/>"
CorpsShift= CorpsShift & "<p style='font-family:Arial, Helvetica, sans-serif;font-size:14px;'>Cordialement<br/>Le Lounge IT.</p>"

CorpsShift= CorpsShift & logoshift+footer & "</td></tr></table>"

dt_Atelier= ateliers("date_atelier") & " de "& FormatDateTime (ateliers("heure_debut_atelier"),4) & " à "& FormatDateTime(ateliers("heure_fin_atelier"),4)

corps = ""
Dt_Atelier = ateliers("date_atelier") & " de " & FormatDateTime(ateliers("heure_debut_atelier"), 4) & " à " & FormatDateTime(ateliers("heure_fin_atelier"), 4)


corps = corps & "<style type='text/css'>"
corps = corps & " .matable{"
corps = corps & " border: 2px solid darkblue;"
corps = corps & " border-collapse: collapse;"
corps = corps & " padding: 10px;"
corps = corps & " width: 550px"
corps = corps & " }"
corps = corps & " .col{"
corps = corps & " font-family:Arial, Helvetica, sans-serif;"
corps = corps & " font-size:14px;"

corps = corps & " }"
corps = corps & ".blog-author-image {"
corps = corps & " position: absolute;"
corps = corps & " top: 100px;"
corps = corps & " left: 200px;"
corps = corps & " opacity:0.1;"
corps = corps & "}"
corps = corps & " </style>"

corps = corps & "<table class='matable'>"
corps = corps & "<tr>"
corps = corps & "<td colspan='3'><img width='650'src='cid:logo ateliers.png'></td>"
corps = corps & "</tr>"
corps = corps & "<tr>"
corps = corps & "<td colspan='3' class='col'>"
corps = corps & "Bonjour " & request.Form("prenom")
corps = corps & ",<br/><br/>Nous vous confirmons votre inscription à l'atelier suivant :"
corps = corps & "</td>"
corps = corps & "</tr>"
corps = corps & "<tr>"
corps = corps & "<td colspan='2' width='80%'>"
corps = corps & "<table border='0' width='100%'><tr>"
corps = corps & "<td valign='top' width='50px' class='col'><b>Atelier</b></td>"
corps = corps & "<td valign='top' class='col'>&nbsp;:&nbsp;</td>"
corps = corps & "<td valign='top' class='col'>" & Nom_atelier & "</td>"
corps = corps & "</tr><tr>"
corps = corps & "<td valign='top' width='50px' class='col'><b>Date</b></td>"
corps = corps & "<td valign='top' class='col'>&nbsp;:&nbsp;</td>"
corps = corps & "<td valign='top' class='col'>" & Dt_Atelier & "</td>"
corps = corps & "</tr><tr>"
corps = corps & "<td valign='top' width='50px' class='col'><b>Site</b></td>"
corps = corps & "<td valign='top' class='col'>&nbsp;:&nbsp;</td>"
corps = corps & "<td valign='top' class='col'>" & ateliers("site_atelier") &"</td>"
corps = corps & "</tr><tr>"
corps = corps & "<td valign='top' width='50px' class='col'><b>Salle</b></td>"
corps = corps & "<td valign='top' class='col'>&nbsp;:&nbsp;</td>"
corps = corps & "<td valign='top' class='col'>" & ateliers("salle") & "</td>"
corps = corps & "</tr></table>"

corps = corps & "<td valign='center' align='left'><img width='100' src='cid:" & imgdyn & "'></td>"

corps = corps & "</tr>"
corps = corps & "<tr>"
corps = corps & "<td colspan='3' class='col'><br/><b>Un lien TEAMS vous sera envoyé avant le début de l'atelier.</b>"
corps = corps & "</td>"
corps = corps & "</tr>"
corps = corps & "<tr>"
corps = corps & "<td colspan='3' class='col'>"
corps = corps & "En cas d'empêchement merci de vous désinscrire de l'atelier en cliquant <br/>sur le le bouton suivant :<br/><br/>"
corps = corps & "<img src='cid:delete.png' width='130'><br/>"
corps = corps & "</td>"
cors = corps & "</tr>"
corps = corps & "<tr>"
corps = corps & "<td colspan='3' class='col'>"
corps = corps & "<br/>Cordialement,<br/>Le Lounge IT.<br/><br/>"
corps = corps & "</td>"
corps = corps & "</tr>"
corps = corps & "<tr>"
corps = corps & "<td colspan='3' style='font-family:Arial, Helvetica, sans-serif;font-size:10px;'>"
corps = corps & "<i>En cas d’incident, veuillez contacter le Help Desk<br/>"
corps = corps & "Afin d’évaluer la qualité des services du Lounge IT, nous vous informons que vous pourriez prochainement être sollicités pour répondre à une enquête de satisfaction"
corps = corps & "</i>"
corps = corps & "</td>"
corps = corps & "</tr>"
corps = corps & "</table>"
corps = corps & " <div><img style='position: absolute;top: 100;left: 200;opacity:0.1;' src='cid:logo lounge.jpg'>"
corps = corps & "</div>"


Dim strTo
Dim strFrom
Dim strSubject
Dim strBody

strTo = request.Form("mail")
strFrom = "noreply"
strSubject = "Confirmation inscription atelier"
myMail.AddAttachment(Fnm)
if ateliers("nom_theme")="SHIFT" then
strBody = CorpsShift
else
strBody = corps
end if


myMail.To = strTo
myMail.From = strFrom
myMail.Subject = strSubject
'myMail.AddAttachment(Fnm)

myMail.HTMLBody = strBody

Set objBP = myMail.AddRelatedBodyPart(Server.MapPath("images/logos/logo lounge.jpg"), "logo lounge.jpg", 1)
objBP.Fields.Item("urn:schemas:mailheader:Content-ID") = "<logo lounge.jpg>"
objBP.Fields.Update

Set objannule = myMail.AddRelatedBodyPart(Server.MapPath("images/delete.png"), "delete.png", 1)
objannule.Fields.Item("urn:schemas:mailheader:Content-ID") = "<delete.png>"
objannule.Fields.Update

set objembrace = myMail.AddRelatedBodyPart(Server.MapPath("images/shift_embrace.png"), "shift_embrace.png", 1)
objembrace.Fields.Item("urn:schemas:mailheader:Content-ID") = "<shift_embrace.png>"
objembrace.Fields.Update

set objleft = myMail.AddRelatedBodyPart(Server.MapPath("images/shift_left.png"), "shift_left.png", 1)
objleft.Fields.Item("urn:schemas:mailheader:Content-ID") = "<shift_left.png>"
objleft.Fields.Update

set objshift = myMail.AddRelatedBodyPart(Server.MapPath("images/logo_shift.png"), "logo_shift.png", 1)
objshift.Fields.Item("urn:schemas:mailheader:Content-ID") = "<logo_shift.png>"
objshift.Fields.Update

Set objappli = myMail.AddRelatedBodyPart(Server.MapPath("images/" & imgdyn), imgdyn, 1)
objappli.Fields.Item("urn:schemas:mailheader:Content-ID") = "<" & imgdyn & ">"
objappli.Fields.Update

set objatelier = myMail.AddRelatedBodyPart(Server.MapPath("images/logo ateliers.png"), "logo ateliers.png", 1)
objatelier.Fields.Item("urn:schemas:mailheader:Content-ID") = "<logo ateliers.png>"
objatelier.Fields.Update


myMail.Send
Set myMail = Nothing
Set cdoConfiguration = Nothing


rendu souhaité :
1648447827128.png


Rendu obtenu :(, le logo est apres le tableau et non transparent
1648448023907.png
 

Statistiques des forums

Discussions
311 724
Messages
2 081 936
Membres
101 844
dernier inscrit
pktla