【发布时间】:2019-07-08 18:27:43
【问题描述】:
我有一个 PHP 脚本,它会在提交时向用户发送电子邮件,但我遇到了一个问题,即消息中的嵌入式链接在 URL 本身中包含 %0D%20。
当您单击链接时,我无法弄清楚如何摆脱它,这显然不是链接。
显示的 URL 是正确的,没有 %0D%20,但是,当您将鼠标悬停在标记上时,我会看到此信息。
当你点击链接时,它会打开:
https://URL/public/dermatology/2019/client_generatePDF.p%0D hp?id=21%08 8&pid=Horus
现在在扩展php中间有一个%0D,在数据库ID中间有一个%08,它来自$last_id,即插入数据库的记录的ID
我也试过 href='" . $url_pdf ."'
这是脚本的链接部分。
$message .= "<tr><td colspan='2'>Link to full history: <a href='$url_pdf' target='_blank'>" . $url_pdf ." </a></td></tr>";
$last_id = $stmt->insert_id;
$PetName2 = trim($_POST['Pet_Name']);
$url = "https://URL/public/dermatology/2019/client_upload_form.php?id=". $last_id . "&pid=" . $PetName2 ;
$url_pdf = "https://URL/public/dermatology/2019/client_generatePDF.php?id=". $last_id . "&pid=" . $PetName2 ;
$email = "SEND EMAIL";
$to = "EMAIL, $ClientEmailAddress";
$from = "VMC Dermatology Form Submission";
$subject = "Dermatology Client Form Submission: " . $UMNCaseNo . "";
$headers = "From: " . strip_tags($email) . "\r\n";
$headers .= "MIME-Version: 1.0 \r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1 \r\n";
$message = '<html><body><h3>A Dermatology Consultation Has Been Submitted.</h3><br />';
$message .= "<br />";
$message .= "<br />";
$message .= "Thank you " . $Client_First_Name ." for filling out the Dermatology Questionnaire for your pet " .$Pet_Name . ". Your information has been received. If applicable, you may submit photos regarding your pets skin condition using the following link. <a href='" .$url. "' > ". $url ."</a>";
$message .= "<br />";
$message .= "<br />";
$message .= "<table rules='all' style='border-color: #666;' cellpadding='10'>";
$message .= "<tr style='background: #eee;'> <td width='178px'><strong>Today's Date:</strong> </td>
<td width='380px'>" . $date2 . "</td></tr>";
$message .= "<tr> <td><strong>Case Number:</strong></td> <td>" . $UMNCaseNo . "</td></tr>";
$message .= "<tr> <td><strong>Clinic to Be Seen at:</strong></td> <td>" . $ClinicToBeSeenAt . "</td></tr>";
$message .= "<tr><td colspan='2'> </td></tr>";
$message .= "<tr> <td><strong>Client Name:</strong> </td><td>" . $Client_First_Name . " ". $Client_Last_Name ."</td></tr>";
$message .= "<tr><td><strong>Client Phone Number:</strong></td> <td>" . $Phone . "</td></tr>";
$message .= "<tr><td><strong>Client Email:</strong></td> <td>" . $ClientEmailAddress . "</td></tr>";
$message .= "<tr><td colspan='2'> </td></tr>";
$message .= "<tr><td colspan='2'> </td></tr>";
$message .= "<tr><td><strong>Pet Name:</strong></td> <td>" . $Pet_Name . "</td></tr>";
$message .= "<tr><td><strong>Species:</strong></td> <td>" . $Species . "</td></tr>";
$message .= "<tr><td><strong>Breed:</strong></td> <td>" . $Breed . "</td></tr>";
$message .= "<tr><td colspan='2'> </td></tr>";
$message .= "<tr style='background: #eee'><td colspan='2'><strong>Reason for Visit:</strong></td></tr>";
$message .= "<tr><td colspan='2'>" . $Reason_for_Visit . "</td></tr>";
$message .= "<tr><td colspan='2'> </td></tr>";
$message .= "<tr><td colspan='2'>Link to full history: <a href='$url_pdf' target='_blank'>" . $url_pdf ." </a></td></tr>";
$message .= "<tr><td colspan='2'> </td></tr>";
$message .= "</table>";
$message .= "</body></html>";
$message .= "<br />";
if(mail($to,$subject,$message,$headers)){
【问题讨论】:
标签: php mime-types mime