开发者

Set background image in google app engine mail API

Tried to insert background image in python. But I receive mail without Images (Text only). Why ?

class MainHandler(webapp.RequestHandler):
def post(self): 

message = mail.EmailMessage(sender="#### Team<abcd@gmail>",
                        subject="Your account has been approved")

    message.to = "David<qerer@gmail.com>"
    message.html = """  <html> 
    <head开发者_Go百科>
    <style type="text/css">
    #backTabl { 
    width:100%x;
    height:100%;
    background-repeat:no-repeat;
    background-image:url(http://www.kerasote.com/files/background/tedkerasote_bkg_blue.jpg);
    }
    </style>
    </head>         
    <body>
    <table id="backTabl" border="0">       
      <tr>  <td width="3%"></td>
         <td valign="top"><br><font face="tahoma" size="2px" >Hi Nijin,   <br><br>             
          Your ###### account has been approved. You can now visit ##### <br><br>             

          Thanks for Using #### <br>
           </font></td> <td width="2%"></td> 
      </tr>
    </table>       
    </body>
    </html>
    """   
    message.send() 


Email clients are VERY picky about how they display HTML emails, they will often strip out css, rework markup and sanitise forms/javascript. This is likely not at issue with AppEngine but an issue with how email clients are presenting your emails. Checkout this article

There are premium services (like Litmus that can help you check your mail in many clients).


Here appengine mail api has nothing to do with this.It just takes the html thats all. I even tried adding your code to mine and tested it with an dummy email. I was able to see the image. I think the problem is with your mail client.

Try this

mail.send_mail(sender="",
                 to="",
                 subject="",
                 body="",
                 html="your html")
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜