Dans la pluspart des webmails, quand j'envoie un mail via CDO, les liens href se voient ajouter un "!" au milieu de l'adresse, ce qui tue le lien.
J'ai contourné le problème sur les webmail testés en entourant la balise a par une balise span, mais c'est pas propre... Comment faire autrement?
J'utilise un template que je lis dans mon code ASP, et dans le template (Mail.html), je mets:
Autant dire, rien d'exceptionnel...
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54 <html> <head><title>Mon titre</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- body { background-color: #6699cc; } body,td,th { font-family: Arial, Helvetica, sans-serif; color: #FFFFFF; } .Style1 { font-size: 24px; font-weight: bold; } a:link { color: #FFFFFF; } a:visited { color: #FFFFFF; } a:hover { color: #FF0000; } a:active { color: #FFFFFF; } .Style2 { font-size: x-small; font-style: italic; } .Style4 {font-size: 36px; font-weight: bold; } --> </style></head> <body bgcolor="#6699cc"> <HR> <table width="90%" border="0" align="center"> <tr> <td align="center" valign="middle" width="100"><span class="Style1"><img src='cid:Visuel.jpg'></span></td> <td valign="middle"><span class="Style4">Un titre</span></td> </tr> </table> <HR> </p> Bonjour {#Tag1#}, <p>Nous avons bien récupéré vos codes personnels.</p> du texte... <a href="http://www.monadresse.com">Le texte pour mon adresse</a> Encore du texte... </body> </html>
Dans la page de traitement ASP, j'utilise le code suivant:
Quelqu'un pourrait-il m'aider?
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
28
29
30
31
32
33
34 function EnvoiMail(MailTo, Name, FirstName) IF MailTo <> "" THEN Dim ObjSendMail Set ObjSendMail = CreateObject("CDO.Message") ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network). ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "Mon adresse de smtp" ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False) ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 ObjSendMail.Configuration.Fields.Update Set FileObj_ = Server.CreateObject("Scripting.FileSystemObject") IF (FileObj_.FileExists(Server.MapPath("Mail.html"))) THEN Set file_ = FileObj_.OpenTextFile(Server.MapPath("Mail.html"), 1, False, -2) ELSE Set file_ = "" Response.Write("Fichier non trouvé") END IF ObjSendMail.To = MailTo ObjSendMail.Subject = "Vos informations de connexion à votre compte" ObjSendMail.From = "Adresse mail pour l'envoi" DO WHILE NOT file_.AtEndOfStream texte_ = file_.readLine texte_ = Replace (texte_, "{#Tag1#}", FirstName + " " + Name) ObjSendMail.HTMLBody = ObjSendMail.HTMLBody + texte_ LOOP ObjSendMail.AddAttachment Server.MapPath("Visuel.jpg"), "picture1", "picture1" ObjSendMail.Send Set ObjSendMail = Nothing END IF End Function
Partager