Я пытаюсь отправить html-сообщение по электронной почте, чтобы оно отображалось с помощью css на iphone и на рабочем столе с помощью outlook 2007. Медиа-запросы работают на iphone, но я смешал результаты с outlook 2007. Я могуконтролировать цвет текста, но не размер шрифта или размер img.
Вот моя почтовая функция:
function mailerExpressBlueHost(array $mailInputs){
require_once 'wp-content/themes/twentytwelve-child/include/phpmailer/PHPMailerAutoload.php';
echo 'entered function <br>';
echo getcwd() . '<br>';
$mail = new PHPMailer();
$mail->IsMail();
$mail->SetFrom('swag@sustainablewestonma.org');
$mail->addAddress($mailInputs['addAddress']); // use for production;
$mail->AddBCC("swag@sustainablewestonma.org"); // set BCC: counts as part of the 500 limit;
$mail->AddEmbeddedImage("wp-content/uploads/2019/09/newswagimage.jpg", "swag-logo");
$body = $mailInputs['body'] ;
$mail->Subject = $mailInputs['subject'] ;
$mail->Body = $body;
$mail->IsHTML(true);
$mail->ContentType="text/HTML";
if(1==1){
if(!$mail->send()) {
echo 'mail not sent <br>' ;
return 'Message could not be sent.' . 'Mailer Error: ' . $mail->ErrorInfo;
}else{
echo 'mail sent <br>';
return 'Message has been sent';
}
}
$mail->ClearAddresses();
}
вот HTML-код, который я пытаюсь отправить:
<!DOCTYPE html>
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
</head>
<body>
<div style="font-size:6vw;text-align:left;margin-left:2vw;color:red;width:100%;">
<img id="img1" style="width:25%;height:auto;margin:0 auto;" src="cid:swag-logo" /><br>
<p style="display:block;width:100%;margin:3vw 0;font-size:6vw;text-align:left;">
Hi,<br><br>
Thank you for your interest in the Sustainable Weston Action Group. If you would like to sign up for our quarterly newsletter or have specific areas of interest/expertise that you would like to share, please complete our Get Involved form:<br><br> <a style="display:block;text-align:center" href="https://www.sustainablewestonma.org/get-involved/">Get-Involved</a><br />
<br />
This information is for Sustainable Weston Action Group use only - we will not share your information with any other parties.<br />
<br />
<br />
Sustainable Weston Action Group
</p>
</div>
<style type="text/css">
@media screen and (min-device-width: 415px){
div{
font-size:5vw;
color:lightblue;
}
#img1{
width:25%!important;
}
}
@media screen and (max-device-width: 414px){
div{
font-size:5vw!important;
color:#538231!important;
}
#img1{
width:50%!important;
}
}
</style>
</body>
</html>
и вот мой контроллер:
<?php
echo getcwd() . '<br>';
require 'wp-content/themes/twentytwelve-child/functionsRaw.php';
//echo htmlspecialchars_decode(file_get_contents('wp-content/themes/twentytwelve-child/views/html/email-footer.html'));
$body = file_get_contents('wp-content/themes/twentytwelve-child/views/html/email-footer.html');
$mailInputs = array("addAddress" => 'rslotpole@gmail.com',
"subject" => 'SWAG Mailing List Confirmation',
"body" => $body);
mailerExpressBlueHost($mailInputs);
echo 'back from function <br>';
?>