大网数据广告活动
服务器运维问答

postfix, dovecot new user domain is localhost instead of my domain

· 52CE 我爱测

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 [email omitted] If I use sendmail -t from …

问题原文

原帖链接 · yo3hcv · CC BY-SA 3.0

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 [email omitted]

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

[email omitted]

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 · CC BY-SA 3.0

@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 :)

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-03-12)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。