1

I use postfix, dovecot and roundcube on my Ubuntu 16.04.

When create new user (unix) then login to roundcube, when I send emails the receiver will get mail from user@localhost instead of user@mysomain.com

If I use sendmail -t from command prompt, emails are delivered with correct

user@mydomain.com

Asking because I recently succeed to broke my postfix and now I am terrified to touch any file :)) So this is a roundcube, dovecot or postfix issue and from where I can correct it.

Thank you in advance,

yo3hcv
  • 123
  • 5
  • Which OS are you using? What's the output of `postconf` or the content of `/etc/postfix/main.cf`? – sebix Mar 12 '17 at 11:57

1 Answers1

1

@sebix thank you for asking, solved, in case anyone need:

This is roundcube problem, default, will consider all users @localhost for login purposes (config.inc.php)

So don't touch this line since is used for login only

$config['default_host'] = 'localhost';

Instead, add this line which is missing

$config['mail_domain'] = '%n';

Where % can be several options

// %n - hostname ($_SERVER['SERVER_NAME'])
// %t - hostname without the first part
// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
// %s - domain name after the '@' from e-mail address provided at login screen
// For example %n = mail.domain.tld, %t = domain.tld

In my case, %n was ok since I have myserver.com (not mail.myserver.com)

The confusing issue is that once users are logged into Roundcube, the identity is stored in MySQL as it was found, so you have to edit manually. For new users (after %n modification) everything will be fine.

That's all :)

yo3hcv
  • 123
  • 5