Smalltalk Pharo ZdcSecureSMTPClient不显示Gmail中的HTML格式? [英] Smalltalk Pharo ZdcSecureSMTPClient not showing html formatting in GMail?
问题描述
我使用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屋!