如何在子域中使用POSTFIX设置仅限SMTP的MTA?

我使用DigitalOcean提供的指南成功设置了SMTP。 不过,这次我想把它设置在一个子域中。 考虑我有这个域名:` http : //v1.product.staging.veil-soft.com 。

我用同样的指南,我不能让电子邮件工作。

这是我的configuration:

main.cfg文件:

 smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) biff = no # appending .domain is the MUA's job. append_dot_mydomain = no readme_directory = no # TLS parameters smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key smtpd_use_tls=yes smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination myhostname = veil-soft.com smtp_generic_maps = hash:/etc/postfix/generic alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases myorigin = /etc/mailname mydestination = veil-soft.com, localhost.localdomain, localhost relayhost = mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = loopback-only inet_protocols = all 

/etc/aliases文件:

 # See man 5 aliases for format postmaster: root root: [email protected] 

/etc/postfix/generic文件:

 [email protected] [email protected] 

/etc/mailname文件:

 veil-soft.com 

试图使用mail命令发送:

 echo "This is the body of the email" | mail -s "Testing" [email protected] 

mail.log产生这个:

 Aug 11 19:57:54 hostname postfix/pickup[8245]: AA598101F08: uid=0 from=<[email protected]> Aug 11 19:57:54 hostname postfix/cleanup[8548]: AA598101F08: message-id=<[email protected]> Aug 11 19:57:54 hostname postfix/qmgr[30043]: AA598101F08: from=<[email protected]>, size=358, nrcpt=1 (queue active) Aug 11 19:57:54 hostname postfix/local[8553]: AA598101F08: to=<[email protected]>, relay=local, delay=0.01, delays=0.01/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox) Aug 11 19:57:54 hostname postfix/qmgr[30043]: AA598101F08: removed Aug 11 20:00:01 hostname postfix/local[8596]: 7B19E101F15: to=<[email protected]>, orig_to=<[email protected]>, relay=local, delay=0.01, delays=0.01/0/0/0, dsn=5.1.1, status=bounced (unknown user: "eng") Aug 11 20:00:01 hostname postfix/qmgr[30043]: 7B19E101F15: removed Aug 11 20:00:01 hostname postfix/local[8597]: 7C8F7101F08: to=<[email protected]>, orig_to=<[email protected]>, relay=local, delay=0.01, delays=0.01/0/0/0, dsn=5.1.1, status=bounced (unknown user: "eng") Aug 11 20:00:01 hostname postfix/qmgr[30043]: 7C8F7101F08: removed 

除非你正在使用某种types的imap服务器或其他什么,我相信你将需要创build一个称为工程的本地用户来工作。 如我错了请纠正我。

这条线路工作:

 Aug 11 19:57:54 hostname postfix/local[8553]: AA598101F08: to=<[email protected]>, relay=local, delay=0.01, delays=0.01/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox).` 

是一个本地用户? 以相同的方式设置engineering

  • 更新为原始答案

根据OP的修改和下面的注释,需要对后缀configuration进行以下更改

问题似乎是服务器打算将邮件中继到vielsoft.com域的另一个SMTP服务器,但是由于错误configuration而试图本地传递。

/etc/postfix/main.cf中

mydestination = v1.product.staging.vielsoft.com

myhostname = v1.product.staging.vielsoft.com

在/ etc /邮件名

v1.product.staging.vielsoft.com