簡體   English   中英

嘗試使用php郵件功能對齊文本發送郵件

[英]Trying to align text sending mail using php mail function

我正在使用PHP郵件功能發送一些HTML文本。

所以文字是

$msg='<h1>This is the mail text i want to center</h1>';

然后我正在使用郵件功能,如:

mail($recipient,$subject,$msg,$mailheaders);

我收到了電子郵件,但所有文本均保持對齊。 我嘗試使用中心標簽

$msg='<center><h1>This is the mail text i want to center</h1></center>';

但郵件永不發送(不允許嗎?)

也嘗試使用樣式屬性

$msg='<h1 style="text-align:center;">This is the mail text i want to center</h1>';

但同樣沒有運氣。 任何想法歡迎

總是很難用一個好的設計發送一封好郵件。

一種(舊的)方法是使用表,但這並不是很好。 現在,您可以使用一些不錯的第三方庫,例如phpmailer或其他。 由於提供者不支持外部CSS,因此您將需要應用內聯CSS。

檢查本文https://www.formget.com/php-send-html-email-template/

暫無
暫無

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

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