簡體   English   中英

PHP問題發送帶有鏈接的郵件並獲取信息

[英]PHP issue sending mail with link and get information

我正在嘗試發送一些帶有php mail()鏈接的文本作為純文本。 鏈接看起來像這樣https://example.com?en=1509,但是在我收到的郵件中,鏈接看起來像這樣https://example.com?en09 如果我單獨發送一個'='沒問題,但是如果我有一個等於數字的數字,它將不再起作用。

這是我用於發送郵件的代碼:

$header[] = 'MIME-Version: 1.0';
$header[] = 'Content-Type: text/plain; charset=UTF-8';
$header[] = 'Content-Transfer-Encoding: quoted-printable';
$header[] = $from;

mail($mail,$titel, $text, implode("\r\n",$header));

有人可以幫我解決這個問題嗎?

[編輯]

如果我看一下Thunderbird郵件源代碼,一切正常,但是顯示錯誤。

MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
From: admin <admin@example.com>
Message-Id: <20160514213835.DD631480051D@example.com>
Date: Sat, 14 May 2016 23:38:35 +0200 (CEST)

https://example.com?en=1545

我也嘗試將鏈接作為text / html發送,並將其包裝到適當的標簽中,但沒有任何效果。 鏈接始終斷開。

謝謝

嘗試添加標題

$headers .= 'Content-type: text/html; charset=utf-8' . "\\r\\n";

而不是'Content-Type: text/plain; charset=UTF-8'; 'Content-Type: text/plain; charset=UTF-8';

希望能幫助到你 !

通過查看不同郵件的源代碼,我在標題中找到以下行:

Content-Transfer-Encoding: 7bit

將我的PHP標頭更改為此后:

$header[] = 'MIME-Version: 1.0';
$header[] = 'Content-Type: text/plain; charset=UTF-8';
$header[] = 'Content-Transfer-Encoding: Content-Transfer-Encoding: 7bit';
$header[] = $from;

mail($mail,$titel, $text, implode("\r\n",$header));

我知道了 鏈接現在正確顯示。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM