Ich versuche, E-Mail mit PHP-Skript zu senden Ich bin erfolgreich. Anstelle von Klartext möchte ich eine HTML-Vorlage senden, die CSS-Design und Tabellen-Daten enthält, aber ich bekomme Klartext. Hier ist der Code:wie man E-Mail als HTML-Vorlage mit PHP-Webmail senden
$headers='Content-Type: text/html; charset="UTF-8"';
$from = 'UCVOGUE';
$subject = 'Order Confirmation from UCVOGUE';
$message = '<html>
<body>
<div class="col-md-12 email-box">
<div class="row">
<div class="col-md-2">
<img src="images/clogo.png" width="50%" class="center-block">
</div>
<div class="col-md-8">
<center><h2>Greetings from Ucvogue</h2></center>
</div>
<div class="col-md-2">
<center><h3>Order No:12501468</h3></center>
</div>
</div><hr>
</div>
<div class="row">
<div class="col-md-12">
<table class="table table-bordered">
<thead>
<tr>
<td>Custome:name</td>
<td>Product</td>
<td>Cost</td>
<td>Units</td>
<td>Total Cost</td>
<td>Address:</td>
</tr>
</thead>
<tbody>
<tr>
<td><?php echo $o_cu_name;?></td>
<td><?php echo $o_pro_name;?></td>
<td><?php echo $o_pro_cost;?></td>
<td><?php echo $o_qty;?></td>
<td><?php echo $o_cost;?></td>
<td><?php echo $o_cu_address;?></td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>
';
mail($to,$subject,$message,$headers);
siehe Screenshot beigefügt, wie ich Klartext anstelle von Bootstrap-HTML-Template-Modell
der Bootstrap folgen möglicherweise nicht zusammen, und Sie müssen Stile selbst hinzuzufügen. Erstellen Sie eine 'template.html' und verwenden Sie in Ihrer PHP-Datei' $ message = file_get_contents (template.html) '. versuchen, wenn das funktioniert – chandlerbing
Ich denke, Sie brauchen eine MIME und/oder FROM-Header: https://StackOverflow.com/Questions/27884043/PHP-email-not-Sending-as-html-why?rq=1 – DragonYen
https://www.w3schools.com/php/func_mail_mail.asp Check Beispiel 3 –