Как заставить postfix принимать почту и класть ее в файл?

Автор tehnology-online, 29-06-2015, 23:03:25

« назад - далее »

tehnology-onlineTopic starter

Поставил postfix. Наладил отправку. А как мне теперь принять почту? И как вообще проверить, в чем загвоздка. Как итог мне нужно принять почту для всех несуществующих пользователей (*@site.ru) и для начала записать ее в файл.

Добавлено: 30-06-2015, 00:25:33


Посмотрел в логи нашел там

NOQUEUE: reject: RCPT from forward20.mail.yandex.net[95.108.253.145]: 454 4.7.1 ........
disconnect from forward20.mail.yandex.net[95.108.253.145]
connect from forward20.mail.yandex.net[95.108.253.145]

Добавлено: 30-06-2015, 15:54:01


telnet localhost 25
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 sd1234-02.keymachine.de ESMTP Postfix (Ubuntu)
421 4.4.2 sd1234-02.keymachine.de Error: timeout exceeded
Connection closed by foreign host.


Добавлено: 30-06-2015, 16:15:11


# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

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

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = sd1234-02.keymachine.de
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = mail.site.ru, sd1234-02.keymachine.de, localhost.keymachine.de, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all

luser_relay = login
local_recipient_maps =
virtual_alias_maps = hash:/etc/postfix/virtual_maps


Добавлено: 30-06-2015, 17:09:19


В файле virtual_maps

@site.ru /home/login/mail
  •  


tehnology-onlineTopic starter

В общем сделал так

virtual_mailbox_domains = /etc/postfix/vhosts
virtual_mailbox_base = /home
virtual_mailbox_maps = hash:/etc/postfix/vmailbox
virtual_uid_maps = static:1001, static:1002
virtual_gid_maps = static:1001, static:1002

В /etc/postfix/vmailbox

@site.ru login/tmp/mail

Запись в файл идет.

а теперь я хочу попробовать отдать php скрипту и пишу в /etc/postfix/vmailbox
@site.ru "|php5-cgi -c /path/to/php.ini /site.ru/public_html/mail.php"

(delivery failed to mailbox /home/| "php5-cgi -c /path/to/php.ini /site.ru/public_html/mail.php": unable to create lock file /home/| "php5-cgi -c /path/to/php.ini /site.ru/public_html/mail.php".lock: No such file or directory)
  •