简而言之,我试图在用户使用php提交联系表单时向用户写入消息。问题是,我试图通过添加样式元素(如粗体)来设置消息的样式,并用<br>
间隔某些行。它似乎适用。在php中添加html属性
以下是代码。
$message = "Welcome". $full_name . "to Company!" . "<br>". "<br>". "<b>". " Company is
the mailbox for the 21st century that evolves per your need. " . "</b>". "<br>". "<br>". "
Letting you interact with you mail by viewing and deciding what to do with it as it is received at a
Company location throughout North America. ". "<b>". "Please use the below information to send a mail/package to your selected address:". "</b>". "<br>". $full_name. "<br>". $address. "<br>". "To login to your dashboard, please visit the following link"."<br>". "<a href=''http://company.com/userinterfaceSelect.php'>Your Dashboard</a>" ;
其中有<br>, <b>,
和一个链接,其中似乎没有适用。
更新;
<?php
if(isset($_POST['submit'])){
$to = $_POST['email'];// this is your Email address
$from = "[email protected]"; // this is the sender's Email address
$full_name = $_POST['fullName'];
$address = $_POST['address'];
$subject = "Welcome to company";
$subject2 = "Copy: New Registration";
$message2 = "New User". "<br>" .$full_name . "\n\n" ;
$message = "Welcome". $full_name . "to company!" . "<br>". "<br>". "<b>". " company is
the mailbox for the 21st century that evolves per your need. " . "</b>". "<br>". "<br>". "
Letting you interact with you mail by viewing and deciding what to do with it as it is received at a
Company location throughout North America. ". "<b>". "Please use the below information to send a mail/package to your selected address:". "</b>". "<br>". $full_name. "<br>". $address. "<br>". "To login to your dashboard, please visit the following link"."<br>". "<a href=''http://company/userinterfaceSelect.php'>Your Dashboard</a>" ;
$headers = "From:" . $from;
$headers2 = "From:" . $to;
mail($to,$subject,$message,$headers);
mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
echo "Your mail has been sent successfuly ! Thank you for your feedback";
// You can also use header('Location: thank_you.php'); to redirect to another page.
}
?>
输出怎么样?在给用户的电子邮件中?在页面上?定义'似乎适用'。等等 – Utkanos 2015-02-06 14:15:15
'在php'中''文体元素'''它确实似乎适用.' ...(͡°͜ʖ͡°) – 2015-02-06 14:16:19
输出到用户的电子邮件 – Jon220 2015-02-06 14:19:40