簡而言之,我試圖在用戶使用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