Postfix:专门用于发送电子邮件的用户

Postfix:专门用于发送电子邮件的用户

我当前的 Postfix 设置只允许向本地用户发送电子邮件(例如,如果我以坐标然后电子邮件将发送为[电子邮件保护])。我有 Courier IMAP 服务器,使用相同的用户坐标但密码与其他地方不同。

现在我想将 RoundCube (RC) 设置为 Webmail 客户端,但不幸的是,它不允许对 IMAP 和 SMTP 使用不同的密码(当您以美国广播公司然后 RC 将使用美国广播公司以及用于 IMAP 发送电子邮件的密码)。我需要什么 - 我想以专门发送电子邮件的用户的方式设置 Postfix,这样所有邮件用户都将使用相同的 SMTP 帐户(但电子邮件应以他们自己的帐户发送,假设他们将使用帐户[电子邮件保护]连接到 SMTP 服务器,然后电子邮件将作为[电子邮件保护])。在这种情况下,我可以设置 RC 以使用该专用帐户进行发送。

如何实现这一点?

答案1

如果您已这样配置,Roundcube 将使用 IMAP 帐户的用户名和密码向 SMTP 服务器进行身份验证,这可能是 Roundcube 的默认设置。

// SMTP username (if required) if you use %u as the username Roundcube
// will use the current username for login
$config['smtp_user'] = '%u';

// SMTP password (if required) if you use %p as the password Roundcube
// will use the current user's password for login
$config['smtp_pass'] = '%p';

您还可以将 Roundcube 配置为仅使用登录数据来登录 IMAP 帐户,但通过特定的 SMTP 服务器发送所有电子邮件。对于 SMTP 服务器,您还可以配置数据进行身份验证,但在某些情况下,localhost您可以不用它。

只需配置字段smtp_hostsmtp_user然后smtp_pass

// SMTP server host (for sending mails).
// See defaults.inc.php for the option description.
$config['smtp_host'] = 'localhost:587';

// SMTP username (if required) if you use %u as the username Roundcube
// will use the current username for login
$config['smtp_user'] = 'rc-send-out-account';

// SMTP password (if required) if you use %p as the password Roundcube
// will use the current user's password for login
$config['smtp_pass'] = 'YOUR-ROUNDCUBE-SMTP-PASSWORD';

配置可以在文件config/config.inc.php


如果您完成了此配置,所有用户通过此 roundcube 实例发送的所有电子邮件都将通过此 SMTP 服务器发送,并使用此身份验证。

因此很明显,如果您指定 SMTP 凭据(例如来自 GMail 帐户),则这不起作用,因为 Google(以及其他免费邮件提供商)在发送邮件时会检查邮件的发件人是否与帐户匹配。

相关内容