我試圖設置郵件正文顯示電子郵件中的鏈接,供用戶下載pdf以備日後需要再次下載時使用。它不是html正文,因爲它在大多數顯示html代碼的電子郵件中都不起作用。所以我決定用電子郵件的純文本代替。電子郵件 - 在電子郵件中包裝「a href」鏈接的正確性是什麼?
$umessage .='<a href="'.home_url('/download.php?f=pdffiles/'.$filename).'"><a href="'.home_url('/download.php?f=pdffiles/'.$filename).'">'.$title.'</a>';
}}
單引號有什麼問題?它顯示在電子郵件:
<a href="http://localhost/download.php?..............">file name</a>
我不認爲雙引號會有所幫助,對不對?
編輯#2
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"
看來,它不會在蘋果以外的任何郵件的電子郵件應用程序很好地工作。
任何想法或者它可能不正確?
編輯#3
$umessage = "Thank you for downloading pdf. \r\n\r\n";
$umessage .= "Please click on the link below to download\r\n";
if(count($selectfiles)>0)
{
foreach($selectfiles as $key)
{
$keyArray = explode('@',$key);
$filename = $keyArray[1];
$title = $keyArray[0];
$umessage .='<p>Download '. '<a href="'.home_url('/download.php?f=pdffiles/'.$filename).'"><a href="'.home_url('/download.php?f=pdffiles/'.$filename).'">'.$title.'</a></p>';
}}
$fm ='xxxx';
$to='xxx';
$subject = "Download Request from ". $name;
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From:<'.$fm.'> ' . "\r\n" . 'Reply-To: ' . $to;
$uto = $email;
$usubject = "Thank you for Downloading our PDF";
wp_mail($to, $subject, $message, $headers);
wp_mail($uto, $usubject, $umessage, $headers);
我不認爲你可以在純文本文件中放置一個html鏈接。有些電子郵件讀者可能會將其轉換爲。 – Iznogood 2012-04-03 02:50:09
大多數用戶現在使用支持HTML的電子郵件客戶端,我會說90%+ – 2012-04-03 03:47:47
向我們顯示完整的電子郵件代碼。 – 2012-04-03 04:33:58