我的三个担忧,尝试了不同的组合但没有结果,谷歌搜索但很少或没有帮助 -
- 我收到了两次电子邮件,更改
myemail@emailserver.com
为电子邮件 ID 以查看结果。 - 在执行此文件时,我正在获取图像,但是我想要文本“已发送电子邮件”。
- 传递带有标签的完整 HTML 内容,而不是电子邮件中的 HTML 呈现。
我的工作代码 -->
<?php
header('Content-type: image/jpeg');
$jpg_image = imagecreatefromjpeg('http://dummyimage.com/600x400/f5f5f5/fff.jpg');
$black = imagecolorallocate($jpg_image, 1, 1, 1);
$font_path = 'myfont/arial.ttf';
$text = "Swapnesh Sinha!";
imagettftext($jpg_image, 24, 0, 175, 85, $black, $font_path, $text);
$tip = imagejpeg($jpg_image);
$imageData = base64_encode($tip);
//$src = 'data: '.mime_content_type($jpg_image).';base64,'.$imageData;
imagedestroy($jpg_image);
?>
<html>
<head></head>
<body>
<p>
<?php
$to = 'myemail@emailserver.com';
$subject = "Thisa is a email test to find image work";
$message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>MY SITE TITLE</title>
</head><body><table><tr><td>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</td></tr><tr><img src="'.'http://mysiteurl/addtext.php'.'" /></tr></table></body></html>';
$headers = 'From: myemail@emailserver.com' . "\r\n" .
'Reply-To: myemail@emailserver.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$bool = mail($to, $subject, $message, $headers);
if($bool)
echo "Email Sent";
else
echo "Email Not Sent";
?>
</body>
</html>
注意- 在<img src="'.'http://mysiteurl/addtext.php'.'" />
http://mysiteurl/addtext.php
与我们拥有上述所有内容的情况相同。