Deuxième
exemple
<%
strFrom = "webmaster@domaine.fr" 'à modifier
(expéditeur)
strTo = ""
filiere = Request.Form("filiere")
select case filiere
case "Administration & Gestion des Entreprises"
strTo = "nom@domaine.fr"
case "Commerce, Distribution, Marketing, Services (DIPLOMES)"
strTo = "nom2@domaine.fr"
case "Commerce, Distribution, Marketing, Services (METIERS)"
strTo = "nom3@domaine.fr"
case "Informatique"
strTo = "nom4@domaine.f"
end select
strSubject = "Demande d'informations depuis le site domaine.fr"
if Len(Trim(strTo)) > 0 then
'Construction du mail
'--------------------
Set mailObj = CreateObject("CDONTS.NewMail")
mailObj.MailFormat = 0 'Format MIME
mailObj.BodyFormat = 0 'Format HTML
lngImportance = 1 'Niveau d'importance du mail
strMessage = "<html><head></head><body><table
width='100%' border='0' cellspacing='0' cellpadding='0'>"
_
& "<tr><td></td><td><font
size='3' face='Times New Roman, Times, serif'><strong>Bonjour,</strong></font></td></tr>"
_
& "<tr><td colspan='2'> </td></tr>"
_
& "<tr><td colspan='2'><strong><font
size='3' face='Times New Roman, Times, serif'>Voici les coordonnées
d'un visiteur du site.fr qui a demandé à recevoir
des informations sur nos formations:</strong></font></td></tr>"
_
& "<tr><td colspan='2'> </td></tr>"
_
& "<tr><td width='17%'><font
size='3' face='Times New Roman, Times, serif'><strong>Nom
: </strong></font></td><td width='83%'><font
size='3' face='Times New Roman, Times, serif' color='#0000FF'><strong> "
& Request.Form("txtNom") & "</strong></font></td></tr>"
_
& "<tr><td><font size='3' face='Times
New Roman, Times, serif'><strong>Prénom : </strong></font></td><td><font
size='3' face='Times New Roman, Times, serif' color='#0000FF'><strong> "
& Request.Form("txtPrenom") & "</strong></font></td></tr>"
_
& "<tr><td><font size='3' face='Times
New Roman, Times, serif'><strong>Adresse : </strong></font></td><td><font
size='3' face='Times New Roman, Times, serif' color='#0000FF'><strong> "
& Request.Form("txtAdresse") & "</strong></font></td></tr>"
_
& "<tr><td><font size='3' face='Times
New Roman, Times, serif'><strong>Code postal : </strong></font></td><td><font
size='3' face='Times New Roman, Times, serif' color='#0000FF'><strong> "
& Request.Form("txtCodepostal") & "</strong></font></td></tr>"
_
& "<tr><td><font size='3' face='Times
New Roman, Times, serif'><strong>Ville : </strong></font></td><td><font
size='3' face='Times New Roman, Times, serif' color='#0000FF'><strong> "
& Request.Form("txtVille") & "</font></td></tr>"
_
& "<tr><td><font size='3' face='Times
New Roman, Times, serif'><strong>E-mail : </strong></font></td><td><a
href='mailto:" & Request.Form("txtEmail")
& "'><font size='3' face='Times New Roman, Times,
serif' color='#0000FF'><strong> " &
Request.Form("txtEmail") & "</a></strong></font></td></tr>"
_
& "<tr><td><font size='3' face='Times
New Roman, Times, serif'><strong>Téléphone
: </strong></font></td><td><font
size='3' face='Times New Roman, Times, serif' color='#0000FF'><strong> "
& Request.Form("txtTelephone") & "</strong></font></td></tr>"
_
& "<tr><td><font size='3' face='Times
New Roman, Times, serif'><strong>Portable : </strong></font></td><td><font
size='3' face='Times New Roman, Times, serif' color='#0000FF'><strong> "
& Request.Form("txtPortable") & "</strong></font></td></tr>"
_
& "<tr><td><font size='3' face='Times
New Roman, Times, serif'><strong>Niveau d'études
: </strong></font></td><td><font
size='3' face='Times New Roman, Times, serif' color='#0000FF'><strong> "
& Request.Form("niveau") & "</strong></font></td></tr>"
_
& "<tr><td><font size='3' face='Times
New Roman, Times, serif'><strong>Filière choisie
: </strong></font></td><td><font
size='3' face='Times New Roman, Times, serif' color='#0000FF'><strong> "
& filiere & "</strong></font></td></tr>"
_
& "<tr><td colspan='2'> </td></tr>"
_
& "<tr><td colspan='2'><strong><font
size='3' face='Times New Roman, Times, serif'>Bien cordialement,</strong></font></td></tr>"
_
& "<tr><td colspan='2'> </td></tr>"
_
& "<tr><td colspan='2'><font size='3'
face='Times New Roman, Times, serif'><strong>Votre
administrateur du <a href='http://www.ciefa.com'>www.ciefa.com</a></strong></font></td></tr>"
_
& "</table></body></html>"
'Envoi du mail
'-------------
mailObj.Send strFrom, strTo, strSubject, strMessage, lngImportance
Set mailObj = Nothing
end if
%>
%>
Remarque
: tout le message est construit en HTML dans la variable
strMessage.
_
permet de couper une ligne. Il faut mettre un espace avant l'underscore
&
permet de reprendre le ligne.
exemple
"eee"
_
& "rrrrr"
équivaut
à écrire "eeerrrrr"
|