-1

swiftmailerを使用してメールを送信しようとしています。EOD を使用する方法はありますか?

この構文 (彼らのウェブサイトから) は、html で何かを構築するための非常に難しい方法のようです。

'<html>' .
' <head></head>' .
' <body>' .
'  Here is an image <img src="' . $cid . '" alt="Image" />' .
'  Rest of message' .
' </body>' .
'</html>',

しかし、これを試してみると

$msg = <<<EOD
<html>
<table>
    <tr>
        <td>
        NAME
        </td>

        <td>
        thomas 
        </td>
    </tr>

    <tr>
        <td>
        COMPANY
        </td>

        <td>
        whatever
        </td>
    </tr>
</table>
<html>
EOD;


   // Set the To addresses with an associative array
->setTo(array('whatever@whatever.whatever'=>'thomas'))

// Give it a body
->setBody($msg)

;

// Send the message
$result = $mailer->send($message);

HTMLが印刷されたメールが届くだけです。これを簡単にする方法はありますか?

4

3 に答える 3

0

たぶん、改行を取り除くことができます。

$msg = str_replace("\r\n","",$msg); 
于 2012-10-24T23:33:25.063 に答える
-1

コンテンツタイプを設定する必要があります。><

->setContentType('text/html')

于 2012-10-24T23:34:20.360 に答える