Roundcube Community Forum

 

How to anonymize Message-IDs

Started by sa5cha, May 30, 2011, 06:38:34 PM

Previous topic - Next topic

sa5cha

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.

SKaero

The message-id is generated by the mail server once you send the message.


sa5cha

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).

sa5cha

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.