所以我有一个标准化的邮件表单,它具有一定的生成细节,必须伴随它包括标题图像。
我想了解如何将图像添加到文本表单中以供发送。
我如何将图像标题添加到我的PHP邮件表单中?
$img_path = 'image12.jpg'; //declaration
while($row = mysql_fetch_array($result))
{
echo "<tr>";
$emailContent=str_replace("\\r\\n","",$row["generic_email_text"]);
echo 'Test';
echo '<td width="450"><textarea name="genericemail">'.$img_path .$emailContent.'</textarea></td>';
echo "</tr>";
}
echo "</tr>";
echo "</table><p>";
我尝试添加img_path到它,但它不会起作用。我正在接替一些我总是觉得困难的代码。所有我这个得到的是IMG(“image12”)
的名字,是我havnt在一段时间
这里做PHP是PHP的拉表单信息
$fullName = $firstName . " " . $lastName;
$imageFile = str_replace = '<img src="http://css-tricks.com/examples/WebsiteChangeRequestForm/images/wcrf-header.png" alt="Website Change Request" />'; //Header here is just a place holder
$updatedEmailText = str_replace("%name%", fieldHtmlFormat($firstName), $updatedEmailText);
$updatedEmailText = str_replace("%firstname%", fieldHtmlFormat($firstName), $updatedEmailText);
$updatedEmailText = str_replace("%lastname%", fieldHtmlFormat($lastName), $updatedEmailText);
$updatedEmailText = str_replace("%duration%", fieldHtmlFormat($durationOfStay), $updatedEmailText);
$updatedEmailText = str_replace("%destination%", fieldHtmlFormat($arrivalCity), $updatedEmailText);
$updatedEmailText = str_replace("%travel%", fieldHtmlFormat($travel), $updatedEmailText);
return $updatedEmailText; .
编辑:
改变代码:
while($row = mysql_fetch_array($result))
{
echo "<tr>";
$emailContent=str_replace("\\r\\n","",$row["generic_email_text"]);
echo 'Test';
//LINE 50'<td width="450"><textarea name="genericemail"><imgsrc="'.$img_path.'"/>'.$emailContent.'</textarea></td>' }//LINE50
echo "</tr>";
echo "</table><p>";
'$ img_path'是什么?一些HTML?或者只是像'/ path/to/images/kittens.jpg'这样的服务器端路径?你不能把html放到这样的textarea中,并期望它被渲染。并且由于这是作为电子邮件发送的,因此无论如何您都无法使用外部映像,因为外部资源并非由地球上的每个邮件客户端自动加载。您需要构建适当的MIME电子邮件,然后嵌入您的图像。 – 2014-11-04 15:15:07
你好,是的这是一个完全自动化的电子邮件,图像在服务器上。感谢您指出我在MIME的方向。我会研究它。 – KieranH19 2014-11-04 15:24:56