Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
0d7daf24
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0d7daf24
编写于
5月 10, 2013
作者:
Z
Zachary Scott
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Document ActionMailer::Base::default, ::mailer_name, and #mailer_name
上级
ff34afc2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
14 deletion
+25
-14
actionmailer/lib/action_mailer/base.rb
actionmailer/lib/action_mailer/base.rb
+25
-14
未找到文件。
actionmailer/lib/action_mailer/base.rb
浏览文件 @
0d7daf24
...
...
@@ -398,7 +398,7 @@ def register_interceptors(*interceptors)
# Register an Observer which will be notified when mail is delivered.
# Either a class or a string can be passed in as the Observer. If a string is passed in
# it will be
<tt>constantize</tt>
d.
# it will be
+constantize+
d.
def
register_observer
(
observer
)
delivery_observer
=
(
observer
.
is_a?
(
String
)
?
observer
.
constantize
:
observer
)
Mail
.
register_observer
(
delivery_observer
)
...
...
@@ -417,9 +417,15 @@ def register_interceptor(interceptor)
def
mailer_name
@mailer_name
||=
anonymous?
?
"anonymous"
:
name
.
underscore
end
# Allows to set the name of current mailer.
attr_writer
:mailer_name
alias
:controller_path
:mailer_name
# Sets the defaults through app configuration:
#
# config.action_mailer.default { from: "no-reply@example.org" }
#
# Aliased by ::default_options=
def
default
(
value
=
nil
)
self
.
default_params
=
default_params
.
merge
(
value
).
freeze
if
value
default_params
...
...
@@ -431,13 +437,15 @@ def default(value = nil)
# Receives a raw email, parses it into an email object, decodes it,
# instantiates a new mailer, and passes the email object to the mailer
# object's +receive+ method. If you want your mailer to be able to
# process incoming messages, you'll need to implement a +receive+
# method that accepts the raw email string as a parameter:
# object's +receive+ method.
#
# If you want your mailer to be able to process incoming messages, you'll
# need to implement a +receive+ method that accepts the raw email string
# as a parameter:
#
# class MyMailer < ActionMailer::Base
# def receive(mail)
# ...
#
#
...
# end
# end
def
receive
(
raw_mail
)
...
...
@@ -448,10 +456,12 @@ def receive(raw_mail)
end
end
# Wraps an email delivery inside of Active Support Notifications instrumentation. This
# method is actually called by the <tt>Mail::Message</tt> object itself through a callback
# when you call <tt>:deliver</tt> on the Mail::Message, calling +deliver_mail+ directly
# and passing a Mail::Message will do nothing except tell the logger you sent the email.
# Wraps an email delivery inside of ActiveSupport::Notifications instrumentation.
#
# This method is actually called by the Mail::Message object itself
# through a callback when you call +:deliver+ on the Mail::Message,
# calling +deliver_mail+ directly and passing a Mail::Message will do
# nothing except tell the logger you sent the email.
def
deliver_mail
(
mail
)
#:nodoc:
ActiveSupport
::
Notifications
.
instrument
(
"deliver.action_mailer"
)
do
|
payload
|
set_payload_for_mail
(
payload
,
mail
)
...
...
@@ -477,7 +487,7 @@ def set_payload_for_mail(payload, mail) #:nodoc:
payload
[
:mail
]
=
mail
.
encoded
end
def
method_missing
(
method_name
,
*
args
)
def
method_missing
(
method_name
,
*
args
)
# :nodoc:
if
respond_to?
(
method_name
)
new
(
method_name
,
*
args
).
message
else
...
...
@@ -514,17 +524,18 @@ def method_missing(*args)
end
end
# Returns the name of the mailer object.
def
mailer_name
self
.
class
.
mailer_name
end
# Allows you to pass random and unusual headers to the new
<tt>Mail::Message</tt> object
# which will add them to itself.
# Allows you to pass random and unusual headers to the new
Mail::Message
#
object
which will add them to itself.
#
# headers['X-Special-Domain-Specific-Header'] = "SecretValue"
#
# You can also pass a hash into headers of header field names and values,
which
# will then be set on the Mail::Message object:
# You can also pass a hash into headers of header field names and values,
# w
hich w
ill then be set on the Mail::Message object:
#
# headers 'X-Special-Domain-Specific-Header' => "SecretValue",
# 'In-Reply-To' => incoming.message_id
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录