summaryrefslogtreecommitdiff
path: root/roundcubemail/program/steps/mail
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2009-09-23 12:28:17 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2009-09-23 12:28:17 +0000
commit309ad6ba484dff0737c8155127c459090cc096bf (patch)
treec27b17ad6d5f952a6c787a82e72d9c702bb24a45 /roundcubemail/program/steps/mail
parentd6f6d493b83ebad6985396f03468853518fc9798 (diff)
- fixed Received header format
git-svn-id: https://svn.roundcube.net/trunk@2982 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/steps/mail')
-rw-r--r--roundcubemail/program/steps/mail/sendmail.inc31
1 files changed, 27 insertions, 4 deletions
diff --git a/roundcubemail/program/steps/mail/sendmail.inc b/roundcubemail/program/steps/mail/sendmail.inc
index b655ff8a7..e8ef47a55 100644
--- a/roundcubemail/program/steps/mail/sendmail.inc
+++ b/roundcubemail/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;
}