簡體   English   中英

使用SwiftMailer發送原始電子郵件標頭

[英]Sending raw email header with SwiftMailer

我想要的是使用SwiftMailer發送原始標頭

目前,這是我可以使用SwiftMailer進行的操作

// Create the message
$message = Swift_Message::newInstance();
$message->setSubject("This email is sent using Swift Mailer");
$message->setBody("You {fullname}, are our best client ever thanks " .
    " to the {transactions} transactions you made with us.");
$message->setFrom("account@bank.com", "Your bank");

使用$message->setFrom()我可以在標題中設置From字段,但是我想要的是這樣的

$rawHeader = 'MIME-Version: 1.0
Content-Type: multipart/alternative;
 boundary="_=_swift_v4_1467746603_bb0677c43b2ba275b8602c907ef7228a_=_"
List-Unsubscribe: <http://go.proctorgallagher.com/unsubscribe/u/45802/41c5731bb75f7959e5880279725cb9b7b4f8996214976c36a0f93e36e88e7705/876424750>
X-Report-Abuse-To: abuse@pd25.com
x-job: 7215816_12853

--_=_swift_v4_1467746603_bb0677c43b2ba275b8602c907ef7228a_=_
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable'

$message->rawHeader($rawHeader);

或者,我不必讓swiftmailer知道Content-Type是字段,值是text/plain

我的意思是,無論我發送的內容是什么,都不必將其分開放置。

你有沒有嘗試過:

$message->setBody("You {fullname}, are our best client ever thanks " .
    " to the {transactions} transactions you made with us.", "text/plain", "utf-8");

暫無
暫無

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

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