Я пишу код для школьного проекта, который отправляет автоматическое электронное письмо (и некоторые другие вещи).
Я подумал, что было бы неплохо написать html-письмо, поэтому я сделал это, но потом обнаружил, что при отправке письма оно содержит только заголовок и заголовки.
Я уже пробовал php.ini, но это бесполезно, так как я использую FTP-сервер в своей школе и у меня нет разрешения на подобные вещи.
Код внизу - это особенная часть моего php, о которой идет речь.
<?php
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=ISO-8859-1\r\n";
$headers .= "From: ymackor <noreply.ymackor@gmail.com>\r\n";
$headers .= "BCC: noreply.ymackor@gmail.com\r\n";
$message = "<html><head><style>table{border-collapse:collapse;border:2px solid black;}tr,td{border-width:1px 0;border-style:solid;border-color:dimgray;padding:0 10px;border-left:.5px solid lightgray;border-right:.5px solid lightgray;text-align:left;style></head><body>";
$message .= "<h2>Your order is handled and sent, it will arrive in 12 hours:</h2>";
$message .= "<table> <tr> <th> Product </th> <th> Quantity </th> <th> Price </th> </tr>";
foreach ($product as $i => $x) {
$message .= "<tr> <td> " . $product_name[$i] . " </td> <td> " . $x . " </td> <td> " . money_format("%^#10.2n", $product_price[$i]) . " </td> </tr>";
}
$message .= "<tr> <th> <u>Total:</u> </th> <th> " . array_sum($product) . " </th> <th> " . money_format("%^#10.2n", array_sum($product_price));
$message .= "</table>";
$message .= "</body></html>";
mail($_POST["email"], "NO-REPLY: Your order", $message, $headers);
?>
и это мой почтовый код:
Delivered-To: yannick.mackor@gmail.com
Received: by 2002:a6b:7110:0:0:0:0:0 with SMTP id q16-v6csp459335iog;
Mon, 25 Jun 2018 02:37:59 -0700 (PDT)
X-Google-Smtp-Source: ADUXVKIPxPM3xq+h6PvxFCto0awYtGAIWLE+HLAWmZA2IWQJe7wA2w8LqLGsAEfNPc0iFt3leNeC
X-Received: by 2002:a50:96d1:: with SMTP id z17-v6mr10591217eda.55.1529919479460;
Mon, 25 Jun 2018 02:37:59 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1529919479; cv=none;
d=google.com; s=arc-20160816;
b=anlEjH3PMUMyGvY2jLrIDXs+frMsdSb8zmigcgmxybAEQPv+yxiM9GPfI0nM1La+iZ
shqeg1I/efpMdOx2bLpqaQfctSAL+kerh0ISFBIg9ojnN1JVpkVZxIzNOGmelPFSGODV
NkAvsKKKC0yIUuTNvsLg+4sCJ3aGnaElrdMsIp0hhNmdZxbSq2AtBu9vQnpvw3eAVG3h
JaVISgiq1SOYlSACKLbPpN7TeyIzmYRjWMPZimmAoLW2u81hH6Qeb2sZfbFLkL8OClJx
zrNIVbkxzVnANtEBioWKWEjA0KxXcgflJjjp8796H+hCHkZYdBGHfZWMQ3i/7vxFc3kQ
grUQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
h=date:sender:message-id:from:mime-version:subject:to
:arc-authentication-results;
bh=PYQtoENArjkziK1+qiQVdq1Wz83XImd871/k1vmO/XM=;
b=j4esNHXiikbTqzvS1GPcZKqbMRPUNvpk99OKjxBLnIszLMyr+USRLYAWyc8YMH1W4l
PtktDEROGgxLZvp6nLhumBMlF2QWZuMdbH2wyvuTnuDaAJCH1haHTaeaLw05yK4mDLSu
YgyzFXU3hDSH07F5hXx3GjaWh49e6Edh+WXz6s1ocCN2qDKzFHPQmrXBHLMufqlrvWXT
8tE0wFaQ0Sbx1daXX0NIMVvLIrE3GXcla+0Nc8BbqlOK+TGhT0HDGZgZ/UAhqMwZQP73
FJPds4DaxF2iOXOtTPae3tu0+GJvOcbCfQS9c632kVeZvxJPCLpTQ6eiToSCmeGBc7FU
fFEA==
ARC-Authentication-Results: i=1; mx.google.com;
spf=pass (google.com: best guess record for domain of cals@da01.informatica-cals.nl designates 87.233.228.82 as permitted sender) smtp.mailfrom=cals@da01.informatica-cals.nl;
dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Return-Path: <cals@da01.informatica-cals.nl>
Received: from da01.informatica-cals.nl (da01.informatica-cals.nl. [87.233.228.82])
by mx.google.com with ESMTPS id n12-v6si977002edr.216.2018.06.25.02.37.59
(version=TLS1 cipher=AES128-SHA bits=128/128);
Mon, 25 Jun 2018 02:37:59 -0700 (PDT)
Received-SPF: pass (google.com: best guess record for domain of cals@da01.informatica-cals.nl designates 87.233.228.82 as permitted sender) client-ip=87.233.228.82;
Authentication-Results: mx.google.com;
spf=pass (google.com: best guess record for domain of cals@da01.informatica-cals.nl designates 87.233.228.82 as permitted sender) smtp.mailfrom=cals@da01.informatica-cals.nl;
dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Received: from cals by da01.informatica-cals.nl with local (Exim 4.80.1) (envelope-from <cals@da01.informatica-cals.nl>) id 1fXNwd-0001xF-45; Mon, 25 Jun 2018 11:37:59 +0200
To: yannick.mackor@gmail.com
Subject: NO-REPLY: Your order
X-PHP-Script: informatica-cals.nl/ymackor/webshop/bestelform.php for 83.128.169.172
MIME-Version: 1.0
Content-type: text/html; charset=ISO-8859-1
From: ymackor <noreply.ymackor@gmail.com>
X-Mailer: PHP/5.2.17
Message-Id: <E1fXNwd-0001xF-45@da01.informatica-cals.nl>
Sender: <cals@da01.informatica-cals.nl>
Date: Mon, 25 Jun 2018 11:37:59 +0200
<html><head><style>table{border-collapse:collapse;border:2px solid black;}tr,td{border-width:1px 0;border-style:solid;border-color:dimgray;padding:0 10px;border-left:.5px solid lightgray;border-right:.5px solid lightgray;text-align:left;style></head><body><h2>Your order is handled and sent, it will arrive in 12 hours:</h2><table> <tr> <th> Product </th> <th> Quantity </th> <th> Price </th> </tr><tr> <td> Ice popsicle </td> <td> 10 </td> <td> $ 0.95 </td> </tr><tr> <td> Hot chocolate </td> <td> 12 </td> <td> $ 9.50 </td> </tr><tr> <td> Self-destructing alarm clock </td> <td> 13 </td> <td> $ 115.00 </td> </tr><tr> <th> <u>Total:</u> </th> <th> 35 </th> <th> $ 125.45</table></body></html>