我对 php mail() 函数有一些奇怪的事情。当我使用 php 发送邮件时,它会随机添加空格,并且某些浮动元素不起作用。
这些是我的标题:
$headers = 'From: ' . $website_naam . ' <' . $eigen_emailadres . '>' . PHP_EOL;
$headers .= 'Reply-To: ' . $naam_verzender . ' <' . $email_verzender . '>' . PHP_EOL;
$headers .= ($bcc_emailadres != '') ? 'Bcc: ' . $bcc_emailadres . PHP_EOL : '';
$headers .= 'X-Mailer: PHP/' . phpversion() . PHP_EOL;
$headers .= 'X-Priority: Normal' . PHP_EOL;
$headers .= 'MIME-Version: 1.0' . PHP_EOL;
$headers .= 'Content-type: text/html; charset=iso-8859-1' . PHP_EOL;
这是我的信息:
$message = '<html><body style="font-family:Open Sans; margin:0; padding:0; font-size:14px; color:#4a4a4a;">';
$message .= '<head>';
$message .= '<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600" rel="stylesheet" type="text/css">';
$message .= '</head>';
$message .= '<div style="width:930px; margin-top:30px; background-color:#fff;">';
$message .= '<div id="logo" style="width:395px; height:54px; float:left;"><a href="http://www.klumpers.nl"><img src="http://www.klumpers.nl/images/logo.png" alt="Klumpers Goud en Diamanthandel" /></a></div>';
$message .= '<div style="clear:both;"></div>';
$message .= '<div style="height:1px; width:930px; background-color:#e2e2e2; margin-top:15px;"></div>';
$message .= '<div style="width:410px; background-color:#f7f7f7; margin-top:20px; padding:20px; float:left;">';
$message .= '<p style="font-size:20px; font-weight:400; color:#4a4a4a; margin:0 0 15px 0;">Gouden sieraden en voorwerpen</p>';
$message .= '<p style="line-height:12px;"> 8 karaat 33,3% goud <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers_goud * 0.333,2)).' per gram</span></p>';
$message .= '<p style="line-height:12px;">14 karaat 58,5% goud <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers_goud * 0.585,2)).' per gram</span></p>';
$message .= '<p style="line-height:12px;">18 karaat 75,0% goud <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers_goud * 0.750,2)).' per gram</span></p>';
$message .= '<p style="line-height:12px;">20 karaat 83,3% goud <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers_goud * 0.833,2)).' per gram</span></p>';
$message .= '<p style="line-height:12px;">21 karaat 87,5% goud <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers_goud * 0.875,2)).' per gram</span></p>';
$message .= '<p style="line-height:12px;">22 karaat 91,6% goud <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers_goud * 0.916,2)).' per gram</span></p>';
$message .= '<p style="line-height:12px;">24 karaat 99,9% goud <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers_goud * 0.999,2)).' per gram</span></p>';
$message .= '<p style="font-size:20px; font-weight:400; color:#4a4a4a; margin:15px 0 15px 0;">Zilveren sieraden en voorwerpen</p>';
$message .= '<p style="line-height:12px;">2e gehalte zilver 83,5% <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers_zilver * 0.80 * 0.835,2)).' per kilo</span></p>';
$message .= '<p style="line-height:12px;">1e gehalte zilver 92,5% <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers_zilver * 0.80 * 0.925,2)).' per kilo</span></p>';
$message .= '<p style="line-height:12px;">Zilveren gulden 72,0% <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers_zilver_gram * 0.80 * 0.720 * 6.475 / 1000,2)).' per stuk</span></p>';
$message .= '<p style="line-height:12px;">Zilveren rijksdaalder 72,0% <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers_zilver_gram * 0.80 * 0.720 * 15 / 1000,2)).' per stuk</span></p>';
$message .= '<p style="line-height:12px;">Zilveren tientje 72,0% <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers_zilver_gram * 0.80 * 0.720 * 25 / 1000,2)).' per stuk</span></p>';
$message .= '<p style="font-size:20px; font-weight:400; color:#4a4a4a; margin:15px 0 15px 0;">Officieel gestempelde edelmetaal baren</p>';
$message .= '<p style="line-height:12px;">Baren fijn goud 99,99% <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers["goud_koers"],2)).' per kilo</span></p>';
$message .= '<p style="line-height:12px;">Baren fijn zilver 99,9% <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers["zilver_koers"],2)).' per kilo</span></p>';
$message .= '<p style="line-height:12px;">Baren fijn platina 99,5% <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers["platina_koers"],2)).' per kilo</span></p>';
$message .= '<p style="line-height:12px;">Baren fijn palladium 99,5% <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers["palladium_koers"],2)).' per kilo</span></p>';
$message .= '</div>';// einde linker box
$message .= '<div style="width:410px; background-color:#f7f7f7; margin-top:20px; padding:20px; float:right;">';
$message .= '<p style="font-size:20px; font-weight:400; color:#4a4a4a; margin:0 0 15px 0;">Gouden Munten</p>';
$message .= '<p style="line-height:12px;">Muntgoud 90,00% <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers_goud * 0.900,2)).' per gram</span></p>';
$message .= '<p style="line-height:12px;">Dukaat 3,49 gram <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers_goud * 0.983 * 3.49,2)).' per stuk</span></p>';
$message .= '<p style="line-height:12px;">20 Frank Belgie 6,45 gram <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers_goud * 0.900 * 6.45,2)).' per stuk</span></p>';
$message .= '<p style="line-height:12px;">20 Frank Frankrijk 6,45 gram <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers_goud * 0.900 * 6.45,2)).' per stuk</span></p>';
$message .= '<p style="line-height:12px;">20 Frank Zwitserland 6,45 gram <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers_goud * 0.900 * 6.45,2)).' per stuk</span></p>';
$message .= '<p style="line-height:12px;">20 Lire Italie 6,45 gram <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers_goud * 0.900 * 6.45,2)).' per stuk</span></p>';
$message .= '<p style="line-height:12px;">10 Gulden Nederland 6,72 gram <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers["goud_koers"] / 1000 * 0.92 * 0.900 * 6.72,2)).' per stuk</span></p>';
$message .= '<p style="line-height:12px;">20 Mark Duitsland 7,96 gram <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers_goud * 0.900 * 7.96,2)).' per stuk</span></p>';
$message .= '<p style="line-height:12px;">Souvereign Engeland 7,99 gram <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers_goud * 0.916 * 7.99,2)).' per stuk</span></p>';
$message .= '<p style="line-height:12px;">20 Kroner D-marken 8,96 gram <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers_goud * 0.900 * 8.96,2)).' per stuk</span></p>';
$message .= '<p style="line-height:12px;">100$ Canada 16,96 gram <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers_goud * 0.916 * 16.96,2)).' per stuk</span></p>';
$message .= '<p style="line-height:12px;">50 ECU Belgie 17,28 gram <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers_goud * 0.900 * 16.96,2)).' per stuk</span></p>';
$message .= '<p style="line-height:12px;">Maple Leaf Canada 31,10 gram <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers["goud_koers"] / 1000 * 0.96 * 0.999 * 31.1035,2)).' per stuk</span></p>';
$message .= '<p style="line-height:12px;">100$ Australie 31,10 gram <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers["goud_koers"] / 1000 * 0.96 * 0.999 * 31.1035,2)).' per stuk</span></p>';
$message .= '<p style="line-height:12px;">20$ USA 33,43 gram <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers_goud * 0.900 * 33.43,2)).' per stuk</span></p>';
$message .= '<p style="line-height:12px;">100 Corona Oosterijk 33,87 gram <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers_goud * 0.900 * 33.87,2)).' per stuk</span></p>';
$message .= '<p style="line-height:12px;">Krugerrand Zuid Afrika 33,93 gram <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers["goud_koers"] / 1000 * 0.92 * 0.916 * 33.93,2)).' per stuk</span></p>';
$message .= '<p style="line-height:12px;">50$ USA 33,93 gram <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers_goud * 0.916 * 33.93,2)).' per stuk</span></p>';
$message .= '<p style="line-height:12px;">50 Pesos Mexico 41,67 gram <span style="float:right; margin-right:20px;">€ '.sprintf("%01.2f",round($koers_goud * 0.900 * 41.67,2)).' per stuk</span></p>';
$message .= '</div>'; // einde rechter box
$message .= '<div style="clear:both;"></div>';
$message .= '</div>';// einde container
$message .= '</body></html>';
这会在 G-mail 客户端中输出:
其他电子邮件客户端更糟糕。