Python 또는 Telnet을 사용하여 접미사를 통해 이메일 보내기


0

mail명령을 사용할 때 올바르게 작동하는 로컬 postfix 서버를 구성 하고 cron deamon에서 전자 메일을받습니다.

그러나 telnet localhost 25서버 를 사용하여 연결하려고하면 명령에 응답하지 않고 CTRL + D가 종료 (정지) 또는 파이썬을 사용하지 않습니다.

import smtplib
server = smtplib.SMTP('localhost', 25)
server.connect()

연결도 동결됩니다

누군가 이것이 어디에서 오는지 알고 있습니까?

정보를 위해 postfix는 GMail을 통해 내 메일을 보냅니다. 여기 내 구성이 있습니다.

mydomain_fallback = localhost
message_size_limit = 10485760
biff = no
mynetworks = 127.0.0.0/8, [::1]/128
smtpd_client_restrictions = permit_mynetworks permit_sasl_authenticated permit
recipient_delimiter = +
smtpd_tls_ciphers = medium
inet_protocols = all
inet_interfaces = loopback-only

# Gmail
relayhost=[smtp.gmail.com]:587
smtp_sasl_auth_enabled=yes
smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options=noanonymous
smtp_sasl_auth_enable=yes
smtp_tls_security_level=encrypt
tls_random_source=dev:/dev/urandom

다음은 mail.log파이썬을 사용하여 연결할 때 의 꼬리입니다 .

May 13 16:06:33 potiron postfix/master[12808]: warning: /usr/libexec/postfix/smtpd: bad command startup -- throttling
May 13 16:06:33 potiron postfix/postscreen[21559]: CONNECT from [127.0.0.1]:59676
May 13 16:06:33 potiron postfix/postscreen[21559]: WHITELISTED [127.0.0.1]:59676
May 13 16:07:33 potiron postfix/smtpd[21562]: warning: database /etc/aliases.db is older than source file /etc/aliases
May 13 16:07:33 potiron postfix/smtpd[21562]: fatal: open /etc/postfix/submit.cred: No such file or directory
May 13 16:07:34 potiron postfix/master[12808]: warning: process /usr/libexec/postfix/smtpd pid 21562 exit status 1
May 13 16:07:34 potiron postfix/master[12808]: warning: /usr/libexec/postfix/smtpd: bad command startup -- throttling

내 연결이 허용 된 것으로 보이지만 59676에서 연결되는 것 같습니다 mynetworks = 127.0.0.0/8, [::1]/128.

답변:


1

해당 로그 덤프의 3 행에서 마지막 행에는 "치명적 : open /etc/postfix/submit.cred : 해당 파일 또는 디렉토리가 없습니다"라고 표시되어 있습니다. 구성 파일의 어딘가에서 /etc/postfix/submit.cred를 참조하십시오. 기본 postfix conf에있는 것처럼 보이지 않지만 보조 구성 중 하나에 있거나 어딘가에 sasl 인증 구성에있을 수도 있습니다 (믿습니다. SASL이 완전히 우회되는지 확실하지 않습니다. 허용 여부).

참고로, /etc/aliases.db는 오래되었습니다. / etc / aliases를 편집했지만 aliases.db를 새로 고치지 않았습니다.


sudo touch /etc/postfix/submit.credBTW를 시도 했지만 아무 소용이 없습니다. 나는 시도했다sudo postfix reload
— oulipo

와우 ... 나는 : sudo touch /etc/postfix/submit.cred그리고 sudo chmod 0600 /etc/postfix/submit.cred 지금 작동하지만 (서버는 연결하기 전에 오랜 시간을 기다립니다)
— oulipo

래퍼를 사용하기가 더 쉽다고 생각합니다 newaliases. 지연이 어떻게 될지 잘 모르겠지만 submit.cred와 관련이있을 수 있습니다. 나는 당신의 시스템 어딘가에서 /etc/postfix/submit.cred가 일종의 인증 스크립트라고 생각하며 그것을 실행할 수 없을 때 혼란스러워합니다. SASL conf를 확인하십시오. SASL이 올바르게 설정되어 있지 않다고 생각합니다. 즉, 허용되지 않은 메일을 보낼 수 없으며 큰 허용 목록을 원하지 않습니다.
— 세스 커리

그것은 단지 스크립팅을 목적으로 내 노트북에만 있기 때문에 별 문제가 없습니다
— oulipo

아, 당신이 올바른지 경우, 허용 된 사이트 목록은 내가 진정한 메일 서버라고 생각하고, 우리 모두가 이미 하하 잘못되는 사람들의 충분이 알고, 그것에 대해 확실히 괜찮
— 세스 카레
당사 사이트를 사용함과 동시에 당사의 쿠키 정책과 개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.