2012-05-10 12 views
0

私はPHPで電子メールを送信しています。それらは私のヘッダーです。私のhtml/textbodyある電子メールを送信し、PHPでMimesを構築する

$headers = array (
'MIME-Version' => '1.0', 
'From' => $from, 
'To' => $to, 
'Return-Path' => '[email protected]', 
'Content-Type'=> 'multipart/alternative', 
'boundary'=>$boundary, 
'Subject' => $subject); 

$random_hash = md5(date('r', time())); 

$bodyHTML = " 
--PHP-alt-$random_hash 
Content-Type: text/plain; charset=utf-8 
Content-Transfer-Encoding: 7bit 
http://example.com/app_dl.php?app_id=$_GET[app_id] to download your $app_name app \n\r\n\r 
Want to get tons more hot apps for free! anywhere anytime? Download our app on http://example.com' \n\r\n\r 
example.com team 
--PHP-alt-$random_hash 
Content-Type: text/html; charset=utf-8 
Content-Transfer-Encoding: 7bit 
<p><a href='http://example.com/app_dl.php?app_id=$_GET[app_id]'>Click Here</a> to download your $app_name app</p> 
<p>Want to get tons more hot apps for free! anywhere anytime? Download our app on <a href='http://example.com'>example.com</a></p> 
<br/> 
<p>example.com team</p> 
--PHP-alt-$random_hash--"; 

私は今、長い時間のためにその問題に貼付されています..私は先頭のスペースを削除する

+0

*あなたが欠けているものは何ですか?このコードではどういう問題がありますか? – deceze

+0

ボディが正しく送信されていないことを確認してください –

答えて

1

試しをしないのです何と改行を追加:

$boundary = "PHP_alt_$random_hash"; 
    $bodyHTML = "--$boundary 
Content-Type: text/plain; charset=utf-8 
Content-Transfer-Encoding: 7bit 

http://example.com/app_dl.php?app_id=$_GET[app_id] to download your $app_name app \n\r\n\r 
Want to get tons more hot apps for free! anywhere anytime? Download our app on http://example.com' \n\r\n\r 
example.com team 

--$boundary 
Content-Type: text/html; charset=utf-8 
Content-Transfer-Encoding: 7bit 

<p><a href='http://example.com/app_dl.php?app_id=$_GET[app_id]'>Click Here</a> to download your $app_name app</p> 
<p>Want to get tons more hot apps for free! anywhere anytime? Download our app on <a href='http://example.com'>example.com</a></p> 
<br/> 
<p>example.com team</p> 

--$boundary--"; 
+0

境界は$ boundary = "PHP-alt - "。$ random_hash; –

+0

境界線の " - "記号を " – Electronick

+0

$ boundary =" PHP_alt _ "。$ random_hash ...と置き換えようとしました。 –

関連する問題