简体   繁体   中英

How create responsive email that send from php?

How to create responsive email just like enter image description here

I see many responsive email have same design which the content in the middle and there is space in right and left side with different color. When the email opened in the mobile device the space in the right and left are gone. Looks like they create it with same way that i dont know how. I send email using php like this

$mail = new PHPMailer(); 
$mail->IsSMTP(); 
$mail->SMTPDebug = 2;  
$mail->SMTPAuth = true; 
$mail->SMTPSecure = 'ssl'; 
$mail->Host = "xxxx";
$mail->Port = xxx; 
$mail->IsHTML(true);
$mail->Username = "xxxx";
$mail->Password = "xxxxx";
$mail->SetFrom("xxxx");
$mail->Subject = "xxxx";
$mail->Body = $htmlContent;
$mail->AddAddress("xxxx@gmail.com");

$htmlContent is the template of html. I've read some information that the css must be inline styles or wouldn't loaded. But if it was inlines then how to use some library like bootstrap, etc. I really beginner about this. Any helps will be apreciated. Thanks.

Personally I would not try to create something like this on your own. There are many awesome packages you can use. I will note some for you:

Or

Good luck! :-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM