2016-08-02 70 views
0

我要的是使用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("[email protected]", "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: [email protected] 
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

我的意思是無論我把它發送,因爲它是沒有把所有東西都分開。

回答

0

你試過:

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

有了這個解決方案,我將不得不再次分別添加的內容 - 我想要的東西放在頭一個地方,與做 - 如果可能的話 – Muhammad