Bonjour,

J'utilise la fonction mail() pour envoyer des emails à mes clients, fournisseur etc.
J'envois le mail en html donc j'ai :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
 
$msg = "<h4><strong>Services : </strong></h4>
- Livraison et plantation d'arbres (partout au Québec) <br />
- Transplantation : pour sauvegarder vos arbres, lors de travaux par exemple<br />
- Élagage, émondage, essouchage, taille d'arbres <br /><br />
 
<h4><strong>Nos Produits : </strong></h4>
- grand arbres : plus de 10 mètre : érable, chêne, frêne, bouleau, tilleul, épinette, pin, etc.<br />";
Je reçois le email, tout est nickel, sauf que j'ai un espace à gauche avant -Élagage...

Si je vire ce bout de code.. c'est Nos produits qui est comme centrer..

une idée du pourquoi ??

Voila le code pour l'envoi du email :

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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
 
 
//----------------------------------
// Construction de l'entête
//----------------------------------
$boundary = "-----=".md5(uniqid(rand()));
 
$header  = "MIME-Version: 1.0\r\n";
$header .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\r\n";
$header .= "\r\n";
 
//--------------------------------------------------
// Construction du message proprement dit
//--------------------------------------------------
 
$msg = "Je vous informe que ceci est un message au format MIME 1.0 multipart/mixed.\r\n";
 
//---------------------------------
// 1ère partie du message
// Le texte
//---------------------------------
$msg .= "--$boundary\r\n";
$msg .= "Content-Type: text/html; charset=\"iso-8859-1\"\r\n";
$msg .= "Content-Transfer-Encoding:8bit\r\n";
$msg .= "\r\n";
 
$msg .= "Bonjour,<br /><br />
La nomEntreprise, est un producteur d'arbre spécialisé dans les arbres de gros calibre (jusqu'à 125mm - 5 pouces).<br/>
 
<br/>
<h4><strong>Services : </strong></h4>
- Livraison et plantation d'arbres (partout au Québec) <br />
- Transplantation : pour sauvegarder vos arbres, lors de travaux par exemple<br />
- Élagage, émondage, essouchage, taille d'arbres<br /><br />
 
<h4><strong>Nos Produits : </strong></h4>
- grand arbres : plus de 10 mètre : érable, chêne, frêne, bouleau, tilleul, épinette, pin, etc.<br />
- petits arbres :  moins de 10 mètres : amélanchier, aubépine, charme, érable de l'Amur, lilais japonais, pommetier, etc.<br />
- arbustes : amélanchier, aronie, cornouiller, lilas, physocarpe, rosier, sureau, viorne, etc.<br />
- cèdres : blanc, noir, smaragd, ainsi que des variétés ornementales<br /><br />
 
<h4><strong>Formats : </strong></h4>
- Différents format sont disponibles selon la variété en pots ou en panier de broche, de 30 cm de hauteur, à plus 125mm de calibre (environ 25 pieds).<br /><br />
 
<h4><strong>Promotions d'automne 30% à 50% </strong> sur arbres de gros calibre: </h4>
- Sur certaine variété nottamment chêne rouge, chêne à gros fruits, frêne rouge, tilleul européen, bouleau jaune, érable à sucre, etc.<br /><br />
 
Pour plus d'informations, n'hésitter pas à nous contacter,
<br /><br />
 
 
 
 
 
Bonne journée,<br /><br />
 
Nom entreprise <br />
<a href='www.siteweb.com' title='' >www.siteweb.com</a><br />
telephone<br /><br />
nomProprio, <br />
Propriétaire";
$msg .= "\r\n";
 
//---------------------------------
// 2nde partie du message
// Le 1er fichier (inline)
//---------------------------------
$file = "images/logo.gif";
$fp   = fopen($file, "rb");   // le b c'est pour les windowsiens
$attachment = fread($fp, filesize($file));
fclose($fp);
$attachment = chunk_split(base64_encode($attachment));
 
$msg .= "--$boundary\r\n";
$msg .= "Content-Type: image/gif; name=\"$file\"\r\n";
$msg .= "Content-Transfer-Encoding: base64\r\n";
$msg .= "Content-Disposition: inline; filename=\"$file\"\r\n";
$msg .= "\r\n";
$msg .= $attachment . "\r\n";
$msg .= "\r\n\r\n";
 
 
 
$destinataire = "xxx@xxx.com";
$expediteur   = "xxx@xxx.com";
$reponse      = $expediteur;
echo "Ce script envoie un mail avec 2 fichiers joints à $destinataire";
mail($destinataire,
     "Promotions et services : Pépinière Saint-Nicolas",
     $msg,
     "Reply-to: $reponse\r\nFrom: $destinataire\r\n".$header);
Merci