Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
b5674375
Commit
b5674375
authored
Nov 02, 2009
by
webchick
Browse files
#239825
by jeffschuler and bjaspan: Add support for OS-specific line endings on e-mails.
parent
7353d5da
Changes
3
Hide whitespace changes
Inline
Side-by-side
includes/mail.inc
View file @
b5674375
...
...
@@ -6,6 +6,12 @@
* API functions for processing and sending e-mail.
*/
/**
* Auto-detect appropriate line endings for e-mails.
* $conf['mail_line_endings'] will override this setting.
*/
define
(
'MAIL_LINE_ENDINGS'
,
isset
(
$_SERVER
[
'WINDIR'
])
||
strpos
(
$_SERVER
[
'SERVER_SOFTWARE'
],
'Win32'
)
!==
FALSE
?
"
\r\n
"
:
"
\n
"
);
/**
* Compose and optionally send an e-mail message.
*
...
...
modules/system/mail.sending.inc
View file @
b5674375
...
...
@@ -45,12 +45,13 @@ public function mail(array $message) {
foreach
(
$message
[
'headers'
]
as
$name
=>
$value
)
{
$mimeheaders
[]
=
$name
.
': '
.
mime_header_encode
(
$value
);
}
$line_endings
=
variable_get
(
'mail_line_endings'
,
MAIL_LINE_ENDINGS
);
return
mail
(
$message
[
'to'
],
mime_header_encode
(
$message
[
'subject'
]),
// Note: e-mail uses CRLF for line-endings
, but
PHP's API requires LF
.
//
They will appear correctly in the actual e-mail that
i
s
se
n
t.
str
_replace
(
"
\r
"
,
''
,
$message
[
'body'
]),
// Note: e-mail uses CRLF for line-endings
.
PHP's API requires LF
//
on Unix and CRLF on Windows. See mail_line_endings
i
n
set
tings.php
.
preg
_replace
(
'@\r?\n@'
,
$line_endings
,
$message
[
'body'
]),
// For headers, PHP's API suggests that we use CRLF normally,
// but some MTAs incorrectly replace LF with CRLF. See #234403.
join
(
"
\n
"
,
$mimeheaders
)
...
...
sites/default/default.settings.php
View file @
b5674375
...
...
@@ -166,6 +166,15 @@
*/
$update_free_access
=
FALSE
;
/**
* Line endings for e-mail messages
*
* Drupal automatically guesses the line-ending format appropriate for your
* system. If you need to override this, uncomment the statement below and set
* it to the line-ending string of your choice.
*/
# $conf['mail_line_endings'] = "\r\n";
/**
* Base URL (optional).
*
...
...
Write
Preview
Supports
Markdown
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