Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3443488
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3443488
Commits
9850918a
Commit
9850918a
authored
15 years ago
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
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide 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) {
}
/**
* Alter any aspect of
the
email
s
sent by Drupal. You can use this hook
* to add a common site footer to all outgoing email
s;
add extra header
* fields and/or modify the mail
s sent out
in any way. HTML-izing the
* outgoing mail
s
is one possibility. See also drupal_mail().
* Alter any aspect of email sent by Drupal. You can use this hook
* to add a common site footer to all outgoing email
,
add extra header
* fields
,
and/or modify the
e
mail in any way. HTML-izing the
* outgoing
e
mail is one possibility. See also drupal_mail().
*
* @param $message
* A structured array containing the message to be altered. Keys in this
* array include:
*
mail_id
* An id to identify the mail sent. Look
into the
module source code
s
* for possible
mail_
id values.
* to
* The
mail
address or addresses
where
the message will be sen
d
to. The
*
- 'id':
* An id to identify the mail sent. Look
at
module source code
*
or drupal_mail()
for possible id values.
*
- '
to
'
* The address or addresses the message will be sen
t
to. The
* formatting of this string must comply with RFC 2822.
* subject
* Subject of the e
-
mail to be sent. This must not contain any newline
* characters, or the mail may not be sent properly.
* body
*
- '
subject
'
* Subject of the email to be sent. This must not contain any newline
* characters, or the
e
mail may not be sent properly.
*
- '
body
'
* An array of lines containing the message to be sent. Drupal will format
* the correct line endings for you.
* from
* The From, Reply-To, Return-Path and Error-To headers in $headers
* are already set to this value (if given).
* headers
* Associative array containing the headers to add. This is typically
* used to add extra headers (From, Cc, and Bcc).
* @return
* None.
* - 'from'
* The address the message will be marked as being from, which is
* either a custom address or the site-wide default email address.
* - 'headers'
* Associative array containing mail headers, such as From, Sender,
* MIME-Version, Content-Type, etc.
*/
function
hook_mail_alter
(
&
$message
)
{
if
(
$message
[
'mail_id'
]
==
'my_message'
)
{
...
...
@@ -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
* An identifier of the mail.
* @param $message
* An array to be filled in. Keys in this array include:
* - '
mail_
id':
* An id to identify the mail sent. Look
into the
module source code
s
* for possible
mail_
id values.
* - 'id':
* An id to identify the mail sent. Look
at
module source code
*
or drupal_mail()
for possible id values.
* - '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.
* - 'subject':
* 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
* the hook is invoked.
* characters, or the mail may not be sent properly.
drupal_mail() sets
*
this to an empty string when
the hook is invoked.
* - 'body':
* 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':
* The From, Reply-To, Return-Path and Error-To headers in $headers
* are already set to this value (if given).
* The address the message will be marked as being from, which is
* set by drupal_mail() to either a custom address or the site-wide
* default email address when the hook is invoked.
* - 'headers':
* Associative array containing the headers to add. This is typically
* used to add extra headers (From, Cc, and Bcc).
* Associative array containing mail headers, such as From, Sender,
* MIME-Version, Content-Type, etc. drupal_mail() pre-fills
* several headers in this array.
* @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
)
{
$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