PHPMailer在本机移动客户端阅读器上显示接收/发送的电子邮件时,电子邮件不会';不能正确显示吗?
我正在使用PHPMailer,在本地移动电子邮件上阅读时,我遇到了一个关于电子邮件输出的小问题。当显示在桌面上时,电子邮件会按预期完美显示。然而,当我尝试通过本机电子邮件阅读器(如iPhone或Android上预装的“邮件”应用程序)阅读它们时,电子邮件会垂直逐字显示,示例如下: 在本机移动应用程序上显示 二, 0 / 0 八, / 二, 0 一, 八, 在桌面或Gmail移动应用程序上显示:PHPMailer在本机移动客户端阅读器上显示接收/发送的电子邮件时,电子邮件不会';不能正确显示吗?,php,email,phpmailer,Php,Email,Phpmailer,我正在使用PHPMailer,在本地移动电子邮件上阅读时,我遇到了一个关于电子邮件输出的小问题。当显示在桌面上时,电子邮件会按预期完美显示。然而,当我尝试通过本机电子邮件阅读器(如iPhone或Android上预装的“邮件”应用程序)阅读它们时,电子邮件会垂直逐字显示,示例如下: 在本机移动应用程序上显示 二, 0 / 0 八, / 二, 0 一, 八, 在桌面或Gmail移动应用程序上显示: <?php //Get Date $_todaysDate = new Date
<?php
//Get Date
$_todaysDate = new DateTime();
$todaysDate = $_todaysDate->format('d/m/Y');
//Set Email Main Body
$body1 = '<img style="margin-left:25%" src="images/DocHeader.png" width="50%">';
$body2 = '<br>'.$todaysDate;
$body3 = '<br><br>Dear Full Name,<br>';
$body4 = '<br>Email Full Body:';
$body5 = '<br><img style="margin-left:25%" src="images/DocFooter.png" width="50%">';
//Set Email Main Body (Footer)
$footer1 = '<strong>Email From</strong>';
$footer2 = '<strong>My Footer</strong>';
//String Together Body & Footer
$body = $body1.'<p style="margin-left:30%;margin-right:25%;">'.$body2.$body3.$body4.$body5.'</p>'.$body19.'<h4>'.$footer1.'</h4><p>'.$footer2.'</p>';
//Start Email
$mail = new PHPMailer(true);
//$mail->SMTPDebug = 2; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'mail.example.com;'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'username@example.com'; // SMTP username
$mail->Password = 'password'; // SMTP password
$mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465; // TCP port to connect to
//Set Recipients
$mail->setFrom('info@example.com', 'Info');
$mail->addAddress('toEmail@example.com', 'To Name'); // Add a recipient
$mail->addReplyTo('info@example.com', 'Info');
$mail->AddBCC("log@example.com", "Email Logs");
//Set Content
$mail->isHTML(true);
$mail->Subject = 'Email Subject';
$mail->Body = ($body);
$mail->AltBody = '';
if(!$mail->Send()) {
$locationLogin = 'Location: FailedLocation.php';
header($locationLogin);
}
else {
$locationLogin = 'Location: SuccessLocation.php';
header($locationLogin);
}
2018年8月20日
有没有人遇到过这个问题,因为我不知道为什么会发生这种情况,整个电子邮件都是这样的?但奇怪的是,只有在本地电子邮件应用程序中,当通过Gmail阅读时,它才显示良好
提前谢谢
代码:
<?php
//Get Date
$_todaysDate = new DateTime();
$todaysDate = $_todaysDate->format('d/m/Y');
//Set Email Main Body
$body1 = '<img style="margin-left:25%" src="images/DocHeader.png" width="50%">';
$body2 = '<br>'.$todaysDate;
$body3 = '<br><br>Dear Full Name,<br>';
$body4 = '<br>Email Full Body:';
$body5 = '<br><img style="margin-left:25%" src="images/DocFooter.png" width="50%">';
//Set Email Main Body (Footer)
$footer1 = '<strong>Email From</strong>';
$footer2 = '<strong>My Footer</strong>';
//String Together Body & Footer
$body = $body1.'<p style="margin-left:30%;margin-right:25%;">'.$body2.$body3.$body4.$body5.'</p>'.$body19.'<h4>'.$footer1.'</h4><p>'.$footer2.'</p>';
//Start Email
$mail = new PHPMailer(true);
//$mail->SMTPDebug = 2; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'mail.example.com;'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'username@example.com'; // SMTP username
$mail->Password = 'password'; // SMTP password
$mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465; // TCP port to connect to
//Set Recipients
$mail->setFrom('info@example.com', 'Info');
$mail->addAddress('toEmail@example.com', 'To Name'); // Add a recipient
$mail->addReplyTo('info@example.com', 'Info');
$mail->AddBCC("log@example.com", "Email Logs");
//Set Content
$mail->isHTML(true);
$mail->Subject = 'Email Subject';
$mail->Body = ($body);
$mail->AltBody = '';
if(!$mail->Send()) {
$locationLogin = 'Location: FailedLocation.php';
header($locationLogin);
}
else {
$locationLogin = 'Location: SuccessLocation.php';
header($locationLogin);
}
我想说的是,所有那些嵌套的左边距
和右边距
指令基本上都使用了所有的小型设备房地产作为保证金。你是对的,我已经删除了保证金和图像,这解决了问题