Smalltalk Pharo ZdcSecureSMTPClient不显示Gmail中的HTML格式? [英] Smalltalk Pharo ZdcSecureSMTPClient not showing html formatting in GMail?

查看:144
本文介绍了Smalltalk Pharo ZdcSecureSMTPClient不显示Gmail中的HTML格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ZdcSecureSMTPClient将一个HTML格式的字符串发送到Gmail帐户。但是当我发送它时,它将以纯文本形式显示html编码。 ie)

I'm using ZdcSecureSMTPClient to send an html formatted string to a gmail account. But when I send it it displays the html encoding as plain text. ie)

mailMessage := MailMessage empty.
mailMessage setField: 'subject' toString: 'Trying to send html '.
mailMessage body: (MIMEDocument contentType: 'text/html\n' 
                content:  '<html><head><b>  Dear   </b></head></html>' 

这显示Gmail为:'html> head> Dear / b> head> / html>'

This shows is Gmail as: 'html> head> Dear /b>/head>/html>'

使用Seaside / Pharo 2.0一次点击图片

Using Seaside/Pharo 2.0 one click image.

推荐答案

你使用什么来设置mime类型不是预期的(此外,消息的内容应该在 body 中,而不是

What you use to set the mime type is not what is expected (additionally, the content of the message should be in body, not head). Use something like the following:

mailMessage := MailMessage empty.
mailMessage setField: 'subject' toString: 'Trying to send html '.
mailMessage addMixedPart: '<html><head></head><body><i>  Dear</i>   </body></html>' contentType: ZnMimeType textHtml printString.

ZdcSecureSMTPClient sendUsingGMailAccount: 'you@gmail.com' password: 'XXXXXXX' to: 'recipient@server.com' message: mailMessage.

您可以通过发送消息 text 到您的消息对象。

You can check that your message is correct by sending the message text to your message object.

这篇关于Smalltalk Pharo ZdcSecureSMTPClient不显示Gmail中的HTML格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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