Bonjour à tous
je ne comprends rien. Mon mail en format html est bizarre.
Voici le code
et j'obtiens ceci:
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 include ("Mail.php"); include("Mail/mime.php"); $crlf = '\n'; $from = "<contact@monserveur.com>"; $to = $email; $subject = $obj; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $htmlBody = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"; $htmlBody .= "<HTML><BODY>"; $htmlBody .= "Bonjour,<br />"; $htmlBody .= "<br />"; $htmlBody .= "blabla"; $htmlBody .= "<br />"; $htmlBody .= "blabla"; $htmlBody .= "<br />"; $htmlBody .= "<br />"; $htmlBody .= "Cordialement."; $htmlBody .= "------------------------------------------------------------------------------"; $htmlBody .= "</BODY></HTML>"; $txtBody = "Bonjour,\n"; $txtBody .= "\n"; $txtBody .= "blabla"; $txtBody .= "\n"; $txtBody .= "blabla"; $txtBody .= "\n"; $txtBody .= "\n"; $txtBody .= "Cordialement.\n"; $txtBody .= "PS : Cet e-mail provient d'un envoi automatisé.\n"; $txtBody .= "------------------------------------------------------------------------------"; $mime = new Mail_Mime($crlf); $mime->setHTMLBody($htmlBody); //$mime->setTXTBody($txtBody); $body = $mime->get(); $headers = $mime->headers($headers); $host = "localhost"; $auth =false; $send = Mail::factory('smtp', array ('host' => $host, 'auth' => $auth)); $mail = $send->send($to, $headers, $body);
si je décommente $mime->setTXTBody($txtBody);
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 B=onjour, blabla blabla Cordialement.-------------=-----------------------------------------------------------------
c'est encore pire!!!
Quelqu'un pourrait m'aider à:
- savoir pourquoi ce caractère '=' apparait?
- comment envoyer un mail en format HTML avec table, div, p, br, etcetera?
un tuto quelque part?
désolée
et merci beaucoup
Partager