<?php
session_start();
include "connections/db.php";
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
$date = date("Y-m-d H:i:s");
$Email = $_POST['email1'];
$link = $_POST['link1'];
include "SMTP.php";
require 'phpmailer/vendor/autoload.php';
include 'PHPMailer.php';
$mail = new PHPMailer(true);
$mail->SMTPDebug = 0;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = '********@gmail.com';
$mail->Password = 'owais@1';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->setFrom('inboxowaislatif@gmail.com', 'Cloud Asset, Oy');
$mail->addAddress($Email, 'Cloud Asset, Oy');
$mail->Subject = 'Download pdf';
$mail->Body =
'
<style>
body
{
background-color:blue;
}
</style>
<body style="background-image: url(http://88.194.145.207:8882/p3-fi/bgimage.jpg); background-repeat: no-repeat; background-position: center; background-size: cover;">
<div style="height:70px;"></div>
<div style="background-image: url(http://88.194.145.207:8882/p3-fi/bgimage.jpg); background-repeat: no-repeat; background-position: center; background-size: cover;"></div>
<div style="
display: flex;
/* Or whatever */
">
<img src="http://88.194.145.207:8882/p3-fi/logo.png" style="
margin: auto;
"/>
</div>
<div style="height:30px; "></div>
<div style="width:50%; height:200px; display:flex; margin:auto; background-image: url(http://88.194.145.207:8882/p3-fi/image2.jpg); background-repeat: no-repeat; background-position: center; background-size: cover;">
<a href="http://88.194.145.207:8882/p3-fi/' .
$link .
'" style="text-align:center; margin:auto;"><img src="http://88.194.145.207:8882/p3-fi/download.png" style="margin:auto; border-radius:100px; cursor:pointer;" /></a><br><br>
</div>
<div style="width:50%; height:50px; margin:auto; background-image: url(http://88.194.145.207:8882/p3-fi/image2.jpg); background-repeat: no-repeat; background-position: center; background-size: cover;">
<h3 style="color:white; text-align:center; margin:0px;"><a href="http://88.194.145.207:8882/p3-fi/' .
$link .
'" style="color:white; text-decoration:none;">DOWNLOAD FILE<a/></h3>
</div>
<div style="width:50%; margin:auto; background-color:white;">
<h3 style="margin:0px; padding-left:30px; padding-right:30px; padding-top:30px; Text-align:center;">P3 SME digital POS for banks,<br>Ready To download</h3>
<p style="padding:20px; text-align:center; margin:0px;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In congue arcu a posuere mattis. Integer mollis eleifend lorem id sodales. Duis sollicitudin diam enim,</p>
</div>
<div style="width:50%; margin:auto; position:relative; text-align:center; background-color:white; height:100px; ">
<button style="background-color:#2C15D9; margin-top:25px; color:white; border-color:blue; border-radius:100px; width:150px; height:30px;"><b>GET NOW</b></button>
</div>
<div style="width:50%; margin:auto; background-color:white; display:flex;">
<table align="center" style="">
<tr style="margin:0px;">
<td style="padding:10px;"><img src="http://88.194.145.207:8882/p3-fi/facebook.png" style="width:20px; height:20px;"/></td>
<td style="padding:10px;"><img src="http://88.194.145.207:8882/p3-fi/twitter.png" style="width:20px; height:20px;"/></td>
<td style="padding:10px;"><img src="http://88.194.145.207:8882/p3-fi/instagram.png" style="width:20px; height:20px;"/></td>
<td style="padding:10px;"><img src="http://88.194.145.207:8882/p3-fi/youtube.png" style="width:20px; height:20px;"/></td>
<td style="padding:10px;"><img src="http://88.194.145.207:8882/p3-fi/google.png" style="width:20px; height:20px;"/></td>
</tr>
</table>
</div>
<div style="width:50%; margin:auto; background-color:white; height:50px;"> </div>
<div style="height:30px;"></div>
<p style="text-align:center; color:white;">@2018 P3 by CloudAssest <a href="#" style="color:white;"><u>Unsubscribe</u></a><p>
</body>
';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
//$mail->AddAttachment($link);
if ($mail->send()) {
$query = "insert into users (user_email,date,download_pdf) values ('$Email','$date','$link')";
$run = mysqli_query($mysqli, $query);
if ($run) {
$_SESSION['username'] = $Email;
echo "Email send successfully";
}
}
?>
大家好, 我正在使用php mailer发送带有模板的电子邮件。它可以与gmail完美配合使用,但是当我在Outlook中对其进行测试时,没有图像显示出来,以上代码与gmail完美配合。
以下图片适用于gmail:
此图片用于展望:
答案 0 :(得分:-1)
默认情况下,Outlook阻止图像。您可以查看Outlook设置
单击文件>选项。 单击信任中心。 单击“信任中心设置”按钮。 取消选中“不要在HTML电子邮件或RSS项目中自动下载图片”选项旁边的框。
第二种解决方法是可以使用
$mailer->AddEmbeddedImage