Roundcube Community Forum

News and Announcements => General Discussion => Topic started by: sa5cha on May 30, 2011, 06:38:34 PM

Title: How to anonymize Message-IDs
Post by: sa5cha on May 30, 2011, 06:38:34 PM
Hi,

I use RoundCube for several e-mail-sender-adresses with one e-mail-account. RoundCube automatically generates Message-IDs like

[email protected]

regardless from what sender-adress I've selected before. For privacy reasons the main.domain should not be used in the message-id, so I'd like RoundCube to create message-ids like

[email protected]

or so...The first part of the id should still remain unique.

Any idea on how I can achieve that? I've studied sendmail.inc, searched the forum and used Google but didn't find anything related.

Thank you in advance.
Title: How to anonymize Message-IDs
Post by: SKaero on May 30, 2011, 08:55:13 PM
The message-id is generated by the mail server once you send the message.
Title: How to anonymize Message-IDs
Post by: sa5cha on May 30, 2011, 09:06:27 PM
Sure? #1486924 (Use host FQDN in Message-Id) (http://trac.roundcube.net/ticket/1486924)
Title: How to anonymize Message-IDs
Post by: sa5cha on May 30, 2011, 09:29:48 PM
Maybe that one from line 1658 func.inc does the job?

// Returns unique Message-ID
function rcmail_gen_message_id()
{
  global $RCMAIL;

  $local_part  = md5(uniqid('rcmail'.mt_rand(),true));
  $domain_part = $RCMAIL->user->get_username('domain');

  // Try to find FQDN, some spamfilters doesn't like 'localhost' (#1486924)
  if (!preg_match('/\.[a-z]+$/i', $domain_part)) {
    if (($host = preg_replace('/:[0-9]+$/', '', $_SERVER['HTTP_HOST']))
      && preg_match('/\.[a-z]+$/i', $host)) {
        $domain_part = $host;
    }
    else if (($host = preg_replace('/:[0-9]+$/', '', $_SERVER['SERVER_NAME']))
      && preg_match('/\.[a-z]+$/i', $host)) {
        $domain_part = $host;
    }
  }

  return sprintf('<%s@%s>', $local_part, $domain_part);
}


Not sure (also on how to change it correctly, if it is the right file).
Title: How to anonymize Message-IDs
Post by: sa5cha on August 11, 2011, 11:02:10 AM
The following works for me:

/program/steps/mail/func.inc

Line 1667

changed

$domain_part = $RCMAIL->user->get_username('domain');

to

$domain_part = $host;

The domain of your roundcube is then used for the message-ID. As I'm not very familiar with programming, I haven't figured out how to use a specific domain name for it yet.