换行html电子邮件 [英] Line break html Email

查看:90
本文介绍了换行html电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

该论坛的新手,并尝试进行一些编码,以帮助一位似乎无法正确解决此问题的朋友.

new to the forum and trying my hand at some coding to help out a friend who cant seem to get this right..

话虽如此,我原本是无法通过电子邮件发送网站上的联系表的问题.经过网上搜索并在其中添加一些组件之后,它终于可以工作了,但是现在我遇到了另一个问题.

with that being said, i was originally having issues with the contact form on a website not being able to send an email. after a bit of searching on the net and adding a few components here and there it is finally working, but now i have an additional problem..

当电子邮件通过发送时(这是一个商业网站,并且从那里将电子邮件发送到相关的销售部门等),所有邮件都被压缩到一行,看起来很糟糕.

when the email gets sent through (this is a business website and it sends an email from there to the relevant sales department etc) its all shoved into one line and looks terrible..

像这样-

名称:来自网站的测试电子邮件电话:011 937 0572电子邮件:myemail@zmail.com消息:请务必确认

"Name: TEST EMAIL FROM WEBSITETel: 011 937 0572Email: myemail@zmail.comMessage: TEST PLEASE CONFIRM

测试38英寸

我无法找到的是如何分隔文本,以使文本作为这样的分隔行通过电子邮件-

what i have not been able to find is how to seperate the text so that it comes through in an email as seperate lines like this-

名称:客户

电话:011 000 0000

Tel: 011 000 0000

电子邮件:myemail@zmail.com

Email: myemail@zmail.com

消息:此处为文字,等等.

Message: text here etc.

我已将联系表单链接到.php文档,所以我认为需要在此文档中进行更改?我试图添加< br/>&< div> ,但是当我尝试从网站发送表单时,除了给我一条错误消息外,什么都没有做.

i have linked the contact form to a .php document, so i would presume that it is in this document that the change would need to take place?? i have tried to add in <br /> & <div> but neither do anything except give me an error message when i try send form from the site.

这是contactgenie.php的代码,该代码链接到100%有效的联系表单

here is the code for the contactgenie.php linked to the contact form that works 100%

<?php

$EmailFrom = "myeamail@zmail.co.za";
$EmailTo = "myemail@zmail.co.za";
$Subject = "Company Name - Online Enquiry";
$Name = Trim(stripslashes($_POST['Name']));
$Tel = Trim(stripslashes($_POST['Tel']));
$Email = Trim(stripslashes($_POST['Email']));
$Message = Trim(stripslashes($_POST['Message']));

// validation
$validationOK=true;
if (!$validationOK) {
  print "There has been an error, please make sure you entered a correct email address."; // You can edit this to your own error message
  exit;
}

// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "";
$Body .= "Tel: ";
$Body .= $Tel;
$Body .= "";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "";

// send email
$success = mail($EmailTo, $Subject, $Body, $Headers = "From: <$EmailFrom\r\n");

// redirect to success page
if ($success){
  print "Thank you, your email has been sent! We will be in touch shortly!"; // You can edit this to your own success message
}
else{
  print "There has been an error, please make sure you have entered your details correctly."; // You can edit this to your own error message
}
?>

对此的任何帮助将不胜感激,谢谢狄龙

any help with this would be greatly appreciated, thanks Dillon

推荐答案

感谢您的所有帮助!我可以使用它,我在代码中添加了"\ n",并且可以正常运行,我只需要用它来分隔文本,以便从站点接收电子邮件时更易于阅读,再次感谢您的帮助用这个!

thanks for all your help guys! i got it to work, i added "\n" into the code and it works perfectly, i just need it to seperate the text so that it is easier to read when the email comes through from the site, thanks again really helped me out with this!

这篇关于换行html电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆