Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
ccd16e18
Commit
ccd16e18
authored
Mar 25, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added mailer to the message when using compose
more expected behavior when chaining methods using Mailser::compose() fixes #2723
parent
53e65b23
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
6 deletions
+16
-6
BaseMailer.php
framework/mail/BaseMailer.php
+1
-2
BaseMessage.php
framework/mail/BaseMessage.php
+15
-4
No files found.
framework/mail/BaseMailer.php
View file @
ccd16e18
...
@@ -188,7 +188,6 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont
...
@@ -188,7 +188,6 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont
$message
->
setTextBody
(
strip_tags
(
$html
));
$message
->
setTextBody
(
strip_tags
(
$html
));
}
}
}
}
return
$message
;
return
$message
;
}
}
...
@@ -205,7 +204,7 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont
...
@@ -205,7 +204,7 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont
if
(
!
array_key_exists
(
'class'
,
$config
))
{
if
(
!
array_key_exists
(
'class'
,
$config
))
{
$config
[
'class'
]
=
$this
->
messageClass
;
$config
[
'class'
]
=
$this
->
messageClass
;
}
}
$config
[
'mailer'
]
=
$this
;
return
Yii
::
createObject
(
$config
);
return
Yii
::
createObject
(
$config
);
}
}
...
...
framework/mail/BaseMessage.php
View file @
ccd16e18
...
@@ -24,14 +24,26 @@ use Yii;
...
@@ -24,14 +24,26 @@ use Yii;
abstract
class
BaseMessage
extends
Object
implements
MessageInterface
abstract
class
BaseMessage
extends
Object
implements
MessageInterface
{
{
/**
/**
* @inheritdoc
* @var MailerInterface the mailer instance that created this message.
* For independently created messages this is `null`.
*/
public
$mailer
;
/**
* Sends this email message.
* @param MailerInterface $mailer the mailer that should be used to send this message.
* If no mailer is given it will first check if [[mailer]] is set and if not,
* the "mail" application component will be used instead.
* @return boolean whether this message is sent successfully.
*/
*/
public
function
send
(
MailerInterface
$mailer
=
null
)
public
function
send
(
MailerInterface
$mailer
=
null
)
{
{
if
(
$mailer
===
null
)
{
if
(
$mailer
===
null
&&
$this
->
mailer
===
null
)
{
$mailer
=
Yii
::
$app
->
getMail
();
$mailer
=
Yii
::
$app
->
getMail
();
}
elseif
(
$mailer
===
null
)
{
$mailer
=
$this
->
mailer
;
}
}
return
$mailer
->
send
(
$this
);
return
$mailer
->
send
(
$this
);
}
}
...
@@ -47,7 +59,6 @@ abstract class BaseMessage extends Object implements MessageInterface
...
@@ -47,7 +59,6 @@ abstract class BaseMessage extends Object implements MessageInterface
return
$this
->
toString
();
return
$this
->
toString
();
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
trigger_error
(
$e
->
getMessage
()
.
"
\n\n
"
.
$e
->
getTraceAsString
());
trigger_error
(
$e
->
getMessage
()
.
"
\n\n
"
.
$e
->
getTraceAsString
());
return
''
;
return
''
;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment