Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
9850918a
Commit
9850918a
authored
Jun 27, 2009
by
Dries Buytaert
Browse files
Options
Downloads
Patches
Plain Diff
- Patch
#359853
by jhodgdon: corrected and improved the documentation of hook_mail_alter().
parent
77c643ec
No related branches found
No related tags found
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/system/system.api.php
+35
-34
35 additions, 34 deletions
modules/system/system.api.php
with
35 additions
and
34 deletions
modules/system/system.api.php
+
35
−
34
View file @
9850918a
...
@@ -491,34 +491,32 @@ function hook_profile_alter(&$account) {
...
@@ -491,34 +491,32 @@ function hook_profile_alter(&$account) {
}
}
/**
/**
* Alter any aspect of
the
email
s
sent by Drupal. You can use this hook
* Alter any aspect of email sent by Drupal. You can use this hook
* to add a common site footer to all outgoing email
s;
add extra header
* to add a common site footer to all outgoing email
,
add extra header
* fields and/or modify the mail
s sent out
in any way. HTML-izing the
* fields
,
and/or modify the
e
mail in any way. HTML-izing the
* outgoing mail
s
is one possibility. See also drupal_mail().
* outgoing
e
mail is one possibility. See also drupal_mail().
*
*
* @param $message
* @param $message
* A structured array containing the message to be altered. Keys in this
* A structured array containing the message to be altered. Keys in this
* array include:
* array include:
*
mail_id
*
- 'id':
* An id to identify the mail sent. Look
into the
module source code
s
* An id to identify the mail sent. Look
at
module source code
* for possible
mail_
id values.
*
or drupal_mail()
for possible id values.
* to
*
- '
to
'
* The
mail
address or addresses
where
the message will be sen
d
to. The
* The address or addresses the message will be sen
t
to. The
* formatting of this string must comply with RFC 2822.
* formatting of this string must comply with RFC 2822.
* subject
*
- '
subject
'
* Subject of the e
-
mail to be sent. This must not contain any newline
* Subject of the email to be sent. This must not contain any newline
* characters, or the mail may not be sent properly.
* characters, or the
e
mail may not be sent properly.
* body
*
- '
body
'
* An array of lines containing the message to be sent. Drupal will format
* An array of lines containing the message to be sent. Drupal will format
* the correct line endings for you.
* the correct line endings for you.
* from
* - 'from'
* The From, Reply-To, Return-Path and Error-To headers in $headers
* The address the message will be marked as being from, which is
* are already set to this value (if given).
* either a custom address or the site-wide default email address.
* headers
* - 'headers'
* Associative array containing the headers to add. This is typically
* Associative array containing mail headers, such as From, Sender,
* used to add extra headers (From, Cc, and Bcc).
* MIME-Version, Content-Type, etc.
* @return
* None.
*/
*/
function
hook_mail_alter
(
&
$message
)
{
function
hook_mail_alter
(
&
$message
)
{
if
(
$message
[
'mail_id'
]
==
'my_message'
)
{
if
(
$message
[
'mail_id'
]
==
'my_message'
)
{
...
@@ -852,33 +850,36 @@ function hook_watchdog(array $log_entry) {
...
@@ -852,33 +850,36 @@ function hook_watchdog(array $log_entry) {
}
}
/**
/**
* Prepare a message based on parameters
. @see
drupal_mail
for more
.
* Prepare a message based on parameters
; called from
drupal_mail
()
.
*
*
* @param $key
* @param $key
* An identifier of the mail.
* An identifier of the mail.
* @param $message
* @param $message
* An array to be filled in. Keys in this array include:
* An array to be filled in. Keys in this array include:
* - '
mail_
id':
* - 'id':
* An id to identify the mail sent. Look
into the
module source code
s
* An id to identify the mail sent. Look
at
module source code
* for possible
mail_
id values.
*
or drupal_mail()
for possible id values.
* - 'to':
* - 'to':
* The
mail
address or addresses
where
the message will be sen
d
to. The
* The address or addresses the message will be sen
t
to. The
* formatting of this string must comply with RFC 2822.
* formatting of this string must comply with RFC 2822.
* - 'subject':
* - 'subject':
* Subject of the e-mail to be sent. This must not contain any newline
* Subject of the e-mail to be sent. This must not contain any newline
* characters, or the mail may not be sent properly.
Empty string when
* characters, or the mail may not be sent properly.
drupal_mail() sets
* the hook is invoked.
*
this to an empty string when
the hook is invoked.
* - 'body':
* - 'body':
* An array of lines containing the message to be sent. Drupal will format
* An array of lines containing the message to be sent. Drupal will format
* the correct line endings for you. Empty array when the hook is invoked.
* the correct line endings for you. drupal_mail() sets this to an empty
* array when the hook is invoked.
* - 'from':
* - 'from':
* The From, Reply-To, Return-Path and Error-To headers in $headers
* The address the message will be marked as being from, which is
* are already set to this value (if given).
* set by drupal_mail() to either a custom address or the site-wide
* default email address when the hook is invoked.
* - 'headers':
* - 'headers':
* Associative array containing the headers to add. This is typically
* Associative array containing mail headers, such as From, Sender,
* used to add extra headers (From, Cc, and Bcc).
* MIME-Version, Content-Type, etc. drupal_mail() pre-fills
* several headers in this array.
* @param $params
* @param $params
* An
arbitrary
array of parameters s
et
by the caller
t
o drupal_mail.
* An array of parameters s
upplied
by the caller o
f
drupal_mail
()
.
*/
*/
function
hook_mail
(
$key
,
&
$message
,
$params
)
{
function
hook_mail
(
$key
,
&
$message
,
$params
)
{
$account
=
$params
[
'account'
];
$account
=
$params
[
'account'
];
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment