summaryrefslogtreecommitdiff
path: root/program/steps/mail/sendmail.inc
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2009-09-23 12:28:17 +0000
committeralecpl <alec@alec.pl>2009-09-23 12:28:17 +0000
commitddc891db460ddabef3194f57177b4f9fb182210e (patch)
treed3d48c756b8ca734f23280704bcad2130aa0561a /program/steps/mail/sendmail.inc
parentdf2a51e3fae66d3b32a634d863af79d0d9a1d77f (diff)
- fixed Received header format
Diffstat (limited to 'program/steps/mail/sendmail.inc')
-rw-r--r--program/steps/mail/sendmail.inc31
1 files changed, 27 insertions, 4 deletions
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index b655ff8a7..e8ef47a55 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -231,17 +231,40 @@ $headers = array();
if ($CONFIG['http_received_header'])
{
$nldlm = $RCMAIL->config->header_delimiter() . "\t";
+ // FROM/VIA
$http_header = 'from ';
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
- $http_header .= rcmail_encrypt_header(gethostbyaddr($_SERVER['HTTP_X_FORWARDED_FOR'])) .
- ' [' . rcmail_encrypt_header($_SERVER['HTTP_X_FORWARDED_FOR']) . ']';
+ $host = $_SERVER['HTTP_X_FORWARDED_FOR'];
+ $hostname = gethostbyaddr($host);
+ if ($CONFIG['http_received_header_encrypt']) {
+ $http_header .= rcmail_encrypt_header($hostname);
+ if ($host != $hostname)
+ $http_header .= ' ('. rcmail_encrypt_header($host) . ')';
+ } else {
+ $http_header .= (($host != $hostname) ? $hostname : '[' . $host . ']');
+ $http_header .= ' ('. ($host == $hostname ? '' : $hostname . ' ') .
+ '[' . $host .'])';
+ }
$http_header .= $nldlm . ' via ';
}
- $http_header .= rcmail_encrypt_header(gethostbyaddr($_SERVER['REMOTE_ADDR'])) .
- ' [' . rcmail_encrypt_header($_SERVER['REMOTE_ADDR']) .']';
+ $host = $_SERVER['REMOTE_ADDR'];
+ $hostname = gethostbyaddr($host);
+ if ($CONFIG['http_received_header_encrypt']) {
+ $http_header .= rcmail_encrypt_header($hostname);
+ if ($host != $hostname)
+ $http_header .= ' ('. rcmail_encrypt_header($host) . ')';
+ } else {
+ $http_header .= (($host != $hostname) ? $hostname : '[' . $host . ']');
+ $http_header .= ' ('. ($host == $hostname ? '' : $hostname . ' ') .
+ '[' . $host .'])';
+ }
+ // BY
+ $http_header .= $nldlm . 'by ' . $_SERVER['HTTP_HOST'];
+ // WITH
$http_header .= $nldlm . 'with ' . $_SERVER['SERVER_PROTOCOL'] .
' ('.$_SERVER['REQUEST_METHOD'] . '); ' . date('r');
$http_header = wordwrap($http_header, 69, $nldlm);
+
$headers['Received'] = $http_header;
}