Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
315
Merge Requests
315
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
c4a548f6
Commit
c4a548f6
authored
Sep 01, 2009
by
webchick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#331180
follow-up by pwolanin and mfb: Fix sending of mail.
parent
5bd9dcef
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
13 deletions
+16
-13
includes/mail.inc
includes/mail.inc
+8
-6
modules/simpletest/simpletest.test
modules/simpletest/simpletest.test
+3
-3
modules/system/system.api.php
modules/system/system.api.php
+3
-3
modules/user/user.module
modules/user/user.module
+2
-1
No files found.
includes/mail.inc
View file @
c4a548f6
...
...
@@ -14,8 +14,9 @@
* appropriate places in the template. Processed e-mail templates are
* requested from hook_mail() from the module sending the e-mail. Any module
* can modify the composed e-mail message array using hook_mail_alter().
* Finally drupal_mail_send() sends the e-mail, which can be reused
* if the exact same composed e-mail is to be sent to multiple recipients.
* Finally drupal_mail_sending_system()->mail() sends the e-mail, which can
* be reused if the exact same composed e-mail is to be sent to multiple
* recipients.
*
* Finding out what language to send the e-mail with needs some consideration.
* If you send e-mail to a user, her preferred language should be fine, so
...
...
@@ -77,7 +78,8 @@
* @param $from
* Sets From to this value, if given.
* @param $send
* Send the message directly, without calling drupal_mail_send() manually.
* Send the message directly, without calling
* drupal_mail_sending_system()->mail() manually.
* @return
* The $message array structure containing all details of the
* message. If already sent ($send = TRUE), then the 'result' element
...
...
@@ -165,7 +167,7 @@ function drupal_mail($module, $key, $to, $language, $params = array(), $from = N
*
* @code
* array(
* 'default-system' => 'D
rupalMailSend
',
* 'default-system' => 'D
efaultMailSystem
',
* 'user' => 'DevelMailLog',
* );
* @endcode
...
...
@@ -175,7 +177,7 @@ function drupal_mail($module, $key, $to, $language, $params = array(), $from = N
*
* @code
* array(
* 'default-system' => 'D
rupalMailSend
',
* 'default-system' => 'D
efaultMailSystem
',
* 'user' => 'DevelMailLog',
* 'contact_page_autoreply' => 'DrupalDevNullMailSend',
* );
...
...
@@ -197,7 +199,7 @@ function drupal_mail_sending_system($module, $key) {
$instances
=
&
drupal_static
(
__FUNCTION__
,
array
());
$id
=
$module
.
'_'
.
$key
;
$configuration
=
variable_get
(
'mail_sending_system'
,
array
(
'default-system'
=>
'D
rupalMailSend
'
));
$configuration
=
variable_get
(
'mail_sending_system'
,
array
(
'default-system'
=>
'D
efaultMailSystem
'
));
// Look for overrides for the default class, starting from the most specific
// id, and falling back to the module name.
...
...
modules/simpletest/simpletest.test
View file @
c4a548f6
...
...
@@ -302,7 +302,7 @@ class SimpleTestMailCaptureTestCase extends DrupalWebTestCase {
$this
->
assertEqual
(
count
(
$captured_emails
),
0
,
t
(
'The captured e-mails queue is empty.'
),
t
(
'E-mail'
));
// Send the e-mail.
$response
=
drupal_mail_send
(
$message
);
$response
=
drupal_mail_send
ing_system
(
'simpletest'
,
'drupal_mail_test'
)
->
mail
(
$message
);
// Ensure that there is one e-mail in the captured e-mails array.
$captured_emails
=
$this
->
drupalGetMails
();
...
...
@@ -323,7 +323,7 @@ class SimpleTestMailCaptureTestCase extends DrupalWebTestCase {
'to'
=>
$this
->
randomName
(
32
)
.
'@example.com'
,
'body'
=>
$this
->
randomString
(
512
),
);
drupal_mail_send
(
$message
);
drupal_mail_send
ing_system
(
'drupal_mail_test'
,
$index
)
->
mail
(
$message
);
}
// There should now be 6 e-mails captured.
...
...
@@ -340,7 +340,7 @@ class SimpleTestMailCaptureTestCase extends DrupalWebTestCase {
// Send the last e-mail again, so we can confirm that the drupalGetMails-filter
// correctly returns all e-mails with a given property/value.
drupal_mail_send
(
$message
);
drupal_mail_send
ing_system
(
'drupal_mail_test'
,
$index
)
->
mail
(
$message
);
$captured_emails
=
$this
->
drupalGetMails
(
array
(
'id'
=>
'drupal_mail_test_4'
));
$this
->
assertEqual
(
count
(
$captured_emails
),
2
,
t
(
'All e-mails with the same id are returned when filtering by id.'
),
t
(
'E-mail'
));
}
...
...
modules/system/system.api.php
View file @
c4a548f6
...
...
@@ -661,9 +661,9 @@ function hook_image_toolkits() {
*
* Email messages sent using functions other than drupal_mail() will not
* invoke hook_mail_alter(). For example, a contributed module directly
* calling the drupal_mail_send
() or PHP mail() function will not invoke this
*
hook. All core modules use drupal_mail() for messaging, it is best practice
* but not manditory in contributed modules.
* calling the drupal_mail_send
ing_system()->mail() or PHP mail() function
*
will not invoke this hook. All core modules use drupal_mail() for
*
messaging, it is best practice
but not manditory in contributed modules.
*
* @param $message
* An array containing the message data. Keys in this array include:
...
...
modules/user/user.module
View file @
c4a548f6
...
...
@@ -2757,7 +2757,8 @@ function user_preferred_language($account, $default = NULL) {
* @param $language
* Optional language to use for the notification, overriding account language.
* @return
* The return value from drupal_mail_send(), if ends up being called.
* The return value from drupal_mail_sending_system()->mail(), if ends up
* being called.
*/
function
_user_mail_notify
(
$op
,
$account
,
$language
=
NULL
)
{
// By default, we always notify except for canceled and blocked.
...
...
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