css不能使用AWS发送电子邮件 [英] css not working in email sending using AWS

查看:151
本文介绍了css不能使用AWS发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在php开发一个网站,并希望在用户注册时向用户发送电子邮件。

I am developing a website in php and want to send email to a user when user signs up.

我能够成功完成。
即使我使用html格式,它以html格式发送。

I am able to do it successfully. Even i using html format and it's sending in html format.

我尝试过这个。我知道图像应该被上传到服务器,但我稍后会这样做。

I tried this. I know images should be uploaded to server but i will do it later.

$bodyPart = '
<body style="background-color:#FFFFFF;">

<img id="header" style="position:absolute; left:85px; top:50px; " src="images/logo.jpg" width="140" height="90" border="0" alt="" /></a>


<img id="cloths" style="position:absolute; left:275px; top:25px;" src="images/cloths.jpg" width="350" height="300" border="0" alt="" /></a>

<font size="7" style="font-family:Times new Roman; position:absolute; left:50px; top:120px;">Thank YOU</font>

<font size="3" style="font-family:Times new Roman;position:absolute;left:50px; top:165px;">For registering with our team </font>

<img id="bag" style ="position:absolute; left:290px; top:345px;"src="images/bag1.jpg" width="250" height="240" border="0" alt="" /></a>

<img style="position:absolute; left:30px; top:440px; "id="watch" src="images/watch1.jpg" width="260" height="180" border="0" alt="" /></a>

</body>

';

  $m->setMessageFromString($plainTextBody,$bodyPart);

  print_r($ses->sendEmail($m));

我应该得到这个输出

但是我得到这个

但问题是格式化是不正确的,即使它在我的本地主机作为一个独立的文件。我试图使用外部CSS,内部CSS和内联CSS。但它不工作

But the problem is formatting is not properly done even if it works in my localhost as a independent file. I tried to use External CSS, Internal CSS and inline CSS. But it's not working.

任何使用html发送电子邮件的CSS示例将非常有帮助。

Any example of CSS working with html in sending email would be very helpful.

提前感谢

推荐答案

更新
如我所想,你刚刚完成了复制粘贴。 。学习HTML基本语法。

UPDATED As i assumed, you have just done copy paste.Try following code. Learn HTML basic syntax.


不要忘记upvote&标记为回答;)

Don't forget to upvote & mark as answered ;)



$bodyPart = ' 

<BODY 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>Untitled Document</title> 
</head> 

<body style="margin-top:20px;"> 
<table width="600" cellpadding="0" cellspacing="0" align="center"> 


<tr> 
  <td> 
    <img id="header" src="images/logo.jpg" width="140" height="90" border="0" alt="" /></a> 
  </td>
  <td>
    <img id="cloths" src="images/cloths.jpg" width="350" height="300" border="0" alt="" /></a> 
  </td>
</tr>

<tr>
  <td>
    <font size="7" style="font-family:Times new Roman;">Thank YOU</font> 
  </td>
  <td>
    <font size="3" style="font-family:Times new Roman;">For registering with our team </font> 
  </td>
</tr>
<tr>
  <td>
    <img id="bag" src="images/bag1.jpg" width="250" height="240" border="0" alt="" /></a> 
  </td>
  <td>
    <img id="watch" src="images/watch1.jpg" width="260" height="180" border="0" alt="" /></a> 
  </td>
  </tr> 
</table>';

echo $bodyPart;

OLDER
使其变得简单。把一个表放在你的html body&固定宽度。

OLDER Make it simple. Put one table in your html body & fixed the width.

您的电子邮件正文应如下所示

Your email body should be like following

$body = <<<BODY
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0" marginwidth="0" marginheight="0">
<table width="600" cellpadding="0" cellspacing="0" align="center">
<tr>
<td>=============Your content =========</td>
</tr>
</table>
BODY;

echo $body;

这篇关于css不能使用AWS发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆