php: swiftmailer 问题
我刚刚安装了 php 的 swiftmailer,我有一些问题:
- 德语元音变音存在问题 - 我收到错误的字符,我需要如何正确编码消息正文?
- swiftmailer 中是否有用于获取服务器日志的属性(发送邮件进行调试时的对话框),
- 如果邮件是纯文本或 html,我如何设置该属性?
谢谢
i've just installed swiftmailer for php and i'm having some questions:
- there's issue with german umlauts - i'm getting wrong characters how do i need to encode the message body properly?
- is there a property in swiftmailer for getting the server log (the dialog when sending mail for debugging)
- how can i set the property if the mail is plain text or html?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
设置纯文本或像这样的 html
纯文本更改为 setBody($message, 'text/plain')
或者设置为:
或
要使元音变音正常工作,请尝试以下操作:
显然将 html 电子邮件的 plain 更改为 html
您也可以使用以下命令进行全局设置:
然而,这是默认的,所以很奇怪你遇到了问题。是邮件正文还是主题有问题?如果与主题相关,请尝试:
set plain text or html like this
for plain text change to setBody($message, 'text/plain')
Alternatively set it with:
or
To get umlauts working try this:
change plain to html for html emails obviously
You can also set it globally with:
However this is default so it is strange you are having problems. Is the problem with the message body or subject? If it is with the subject try:
您可以使用
setBody
或addPart< 的第三个参数来设置字符集 /代码>。您需要确保传递的字符串已经在该字符集中。
您应该能够通过 启用日志插件之一。
您可以通过 将内容类型传递给
setBody
来定义消息的 HTML 格式或addPart
。我强烈建议您浏览全面的在线文档以获取有关这些主题的更多信息。
You can set the character set using the third parameter of
setBody
oraddPart
. You'll want to make sure that the passed string is already in that character set.You should be able to do this by enabling one of the logging plugins.
You can define the HTML-yness of a message by passing the content type to
setBody
oraddPart
.I highly recommend that you browse through the comprehensive online documentation for more information on these topics.