为 VPS 上的虚拟服务器设置电子邮件帐户

为 VPS 上的虚拟服务器设置电子邮件帐户

我正在设置自己的 VPS,到目前为止,我已经成功在其上设置了几个域作为虚拟主机。这些网站运行良好,现在我需要为每个网站添加电子邮件帐户。我还在服务器上安装了 Webmin 和 Vvirtualmin。

所以我有可以使用的域名,例如:

- www.mydomain1.com

- www.mydomain2.com

现在我想要一个可以通过 squirrelmail 在线访问的电子邮件帐户,也可以通过桌面上的 thunderbird 或 outlook 访问。

例子:

- [email protected]
- [email protected]

- [email protected]
- [email protected]

等等。

我很感激有人能指导我如何实现这一点,我已经通过 apt-get 安装了 postfix、dovecot、spamassassin 和 squirrelmail。我的下一步是什么?我似乎找不到适合这种情况的教程,尽管这种情况一定很常见。

谢谢!

答案1

这是一个例子

如果您使用sendmail,请将您的域名放在/etc/mail/local-host-names和中/etc/mail/generics-domains
之后,在 中/etc/mail/genericstable添加您的用户电子邮件,格式如下:

myuser [email protected]
myotheruser [email protected]

/etc/mail/virtusertable添加反转:

[email protected] myuser
[email protected] myotheruser

/etc/mail/sendmail.mc使用此配置时,将域名更改为您的主域:


VERSIONID(`setup for linux')dnl  
OSTYPE(`linux')dnl  
define(`confDOMAIN_NAME', `myprimarydomain.dom')dnl 
define(`SMART_HOST',`myprimarydomain.dom')dnl
define(`SMTP_MAILER_MAXMSGS',`40')dnl
define(`confDEF_USER_ID',``8:12'')dnl
define(`confTO_CONNECT', `1m')dnl
define(`confTRY_NULL_MX_LIST',true)dnl
define(`confDONT_PROBE_INTERFACES',true)dnl
define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')dnl
define(`PROCMAIL_MAILER_FLAGS', `mSDFMhun')dnl
define(`ALIAS_FILE', `/etc/aliases')dnl
define(`STATUS_FILE', `/var/log/mail/statistics')dnl
define(`UUCP_MAILER_MAX', `2000000')dnl
define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl
dnl define(`confPRIVACY_FLAGS', `goaway,nobodyreturn,authwarnings,novrfy,noexpn,restrictqrun')dnl
dnl define(`confPRIVACY_FLAGS', `goaway,nobodyreturn,authwarnings,noexpn,restrictqrun')dnl
define(`confAUTH_OPTIONS', `A')dnl

DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea')dnl
DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl
dnl DAEMON_OPTIONS(`Port=smtps, Name=TLSMTA, M=s')dnl

dnl INPUT_MAIL_FILTER(`greylist',`S=local:/var/run/milter-greylist/milter-greylist.sock')dnl
dnl INPUT_MAIL_FILTER(`greylist',`S=inet:3333@localhost, F=T, T=S:1m;R:2m;E:3m')dnl

define(`confMILTER_MACROS_CONNECT', confMILTER_MACROS_CONNECT`,{daemon_port}')dnl
define(`confMILTER_MACROS_HELO', confMILTER_MACROS_HELO`,{verify},{client_resolve}')dnl
define(`confMILTER_MACROS_ENVRCPT', confMILTER_MACROS_ENVRCPT`,{client_resolve}')dnl
define(`confMILTER_MACROS_CONNECT', `H, j, _, {daemon_name}, {daemon_port}, {if_name}, {if_addr}, {client_addr}')dnl
define(`confMILTER_MACROS_HELO', `{verify}, {cert_subject}')dnl
define(`confMILTER_MACROS_ENVFROM', `i, {auth_type}, {auth_authen},{auth_ssf}, {auth_author}, {mail_mailer}, {mail_host}, {mail_addr},{md_tag}')dnl
define(`confMILTER_MACROS_ENVRCPT', `{greylist}')dnl


INPUT_MAIL_FILTER(`spamassassin', `S=unix:/var/run/spamass-milter/spamass-milter.sock, F=, T=C:15m;S:4m;R:4m;E:10m')dnl
define(`confMILTER_MACROS_CONNECT',`t, b, j, _, {daemon_name}, {if_name}, {if_addr}')dnl
define(`confMILTER_MACROS_HELO',`s, {tls_version}, {cipher}, {cipher_bits}, {cert_subject}, {cert_issuer}')dnl
define(`confMILTER_MACROS_ENVRCPT',`r, v, b, Z')dnl

define(`confAUTH_MECHANISMS', `LOGIN PLAIN  DIGEST-MD5 CRAM-MD5')dnl
TRUST_AUTH_MECH(`LOGIN PLAIN  DIGEST-MD5 CRAM-MD5')dnl

define(`confCACERT_PATH',`/etc/pki/tls/certs')dnl
define(`confCACERT',`/etc/pki/tls/certs/ca-bundle.crt')dnl
define(`confSERVER_CERT',`/etc/pki/tls/certs/sendmail.pem')dnl
define(`confSERVER_KEY',`/etc/pki/tls/certs/sendmail.pem')dnl
define(`confCLIENT_CERT',`/etc/pki/tls/certs/client.crt')dnl
define(`confCLIENT_KEY',`/etc/pki/tls/certs/client.key')dnl
define(`confCRL',`/etc/pki/tls/certs/revoke.crl')dnl
define(`confTLS_SRV_OPTIONS', `V')
define(`confTO_IDENT', `0')dnl
FEATURE(`no_default_msa',`dnl')dnl
FEATURE(`smrsh',`/usr/sbin/smrsh')dnl
FEATURE(`mailertable',`hash -o /etc/mail/mailertable.db')dnl
FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable.db')dnl
FEATURE(`genericstable',`hash -o /etc/mail/genericstable.db')dnl
GENERICS_DOMAIN_FILE(`/etc/mail/generics-domains')dnl
FEATURE(redirect)dnl
FEATURE(always_add_domain)dnl
FEATURE(use_cw_file)dnl
FEATURE(use_ct_file)dnl
FEATURE(local_procmail,`',`procmail -t -Y -a $h -d $u')dnl
FEATURE(`access_db',`hash -T -o /etc/mail/access.db')dnl
FEATURE(`blacklist_recipients')dnl
EXPOSED_USER(`root')dnl
FEATURE(`accept_unresolvable_domains')dnl
dnl FEATURE(`dnsbl', `relays.ordb.org', `Rejected - see http://ordb.org/')dnl
dnl FEATURE(`dnsbl', `bl.spamcop.net')dnl
dnl FEATURE(`dnsbl', `sbl.spamhaus.org')dnl
dnl FEATURE(`dnsbl', `blackholes.mail-abuse.org')dnl
dnl FEATURE(`dnsbl', `relays.mail-abuse.org')dnl
LOCAL_DOMAIN(`myprimarydomain.dom')dnl
FEATURE(masquerade_envelope)dnl
FEATURE(masquerade_entire_domain)dnl
MASQUERADE_DOMAIN(localhost)dnl
MASQUERADE_DOMAIN(localhost.localdomain)dnl
MAILER(smtp)dnl
MAILER(procmail)dnl
define(`confLOG_LEVEL', `14')dnl

完成后,重新启动sendmail

相关内容