简体   繁体   English

如何使用Lithium中的视图呈现电子邮件?

[英]How to render an email using a view in Lithium?

In Lithium documentation is written that *View::$_request* 在Lithium文档中写有* View :: $ _ request *

"Holds the details of the current request that originated the call to this view, if applicable. May be empty if this does not apply. For example, if the View class is created to render an email." “保留发出对该视图的调用的当前请求的详细信息(如果适用)。如果不适用,则可以为空。例如,如果创建了View类来呈现电子邮件。”

But how to use a view to render an email? 但是如何使用视图呈现电子邮件? It is possible to instantiate a view and not send it to the browser, but get the content and send it with mail()? 可以实例化视图而不将其发送到浏览器,但是可以获取内容并通过mail()发送它吗?

Take a look to li3_mailer plugin. 看一下li3_mailer插件。

From the docs, an answer to your question : 在文档中,您的问题的答案:

Rendering email messsages is similar to rendering responses with a few exceptions. 呈现电子邮件消息类似于呈现响应,但有一些例外。 The most important is that instead of having a request which can be negotiated to infer the most suitable (single) type for response the email message may have multiple types (and does not have a 'corresponding' request). 最重要的是,电子邮件消息可能具有多种类型(并且没有“对应”请求),而不是具有可以协商以推断出最合适(单个)响应类型的请求。 To support this the plugin implements a mail Media class simlar to http's Media , which can be used to register new types or configure the built-ins. 为了支持此功能,该插件实现了类似于http的Media的邮件Media类,该类可用于注册新类型或配置内置组件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM