Why smtplib.SMTP (). Sendmail does not send a signed DKIM message

I installed postfix on the server along with openDKIM.

When I run:

echo "Testing setup" | mail -s "Postfix test" {my_email_address}

I get a letter, and there is a heading in the message headers DKIM-Signature.

When, however, I write a python script to send email using smtplib:

import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.utils import make_msgid

msg = MIMEMultipart('alternative')
part1 = MIMEText('Hello, world', 'plain')
msg.attach(part1)
msg['From'] = 'alert@{my_domain}'
msg['To'] = '{my_email_address}'
msg['Subject'] = 'Test Email'
msg['Message-ID'] = make_msgid()

mailer = smtplib.SMTP('localhost')
mailer.sendmail('alert@{my_domain}', '{my_email_address}', msg.as_string())
mailer.quit()

The email that comes to my inbox does not have a header DKIM-Signature, but in Authentication-ResultsI seedkim=none (no signatures found);

So my question is: Do I need to sign my email address manually (for example, using dkimpy), or is there some setting that I can enable for it to sign for me?

Let me know if there is any additional information that you need / need.

+4
source share
1 answer

, - . OpenDKIM :

, , : (1) From: ( ) -d (2) (a) , MTA, (b) , MTA , InternalHosts ( ), (c) , MTAs (d) MTA , , MacroList.

SMTP- MTA. , : OpenDKIM , , localhost InternalHosts? ( , , , , .)

+1

Source: https://habr.com/ru/post/1694326/


All Articles