1

Topic: Postfix not processing CC field when mail sent from Python smtplib

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.3.1 MARIADB edition.
- Deployed with iRedMail Easy or the downloadable installer? downloadable installer
- Linux/BSD distribution name and version: CentOS Linux release 8.2.2004 (Core)
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Apache
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

When i try to send an email using my python code that's using smtplib, email was sent successfully but CC header is ignored by postfix for some reason.
When i receive an email, i see the recipient in CC field and i can use "Reply All". But CC recipient hasn't received that email and Postfix logs do not show that email was sent to CC. If i use "Reply All", CC will then receive my reply.

This is the header that is being formed by Python.

Content-Type: multipart/mixed; boundary="===============0783044642835671299=="
MIME-Version: 1.0
From: admin@example.com
To: someemail@other.com
Cc: cc-someemail@other.com
Subject: Bill

--===============0783044642835671299==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit

Auto generated. Bill is: 1234
--===============0783044642835671299==
Content-Type: application/octet-stream
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename= Racun.pdf

JVBERi0xLjQKJeLjz9MKMyAwIG9iago8PC9JbnRlbnQvUGVyY2VwdHVhbC9EZWNvZGVQYXJtczw8
...

Any ideas why would this be ignored? Much appreciated!

2

Re: Postfix not processing CC field when mail sent from Python smtplib

Specify Cc addresses in your Python code (e.g. the "sendmail()" function).
The From/To/Cc/Bcc headers in submitted message are not read by Postfix, only the "MAIL FROM:", "RCPT TO:" smtp directives are used by Postfix to pick up sender/recipients.

----

Buy me a cup of coffee ($5) to support iRedMail:

buy me a cup of coffee

3

Re: Postfix not processing CC field when mail sent from Python smtplib

But sendmail() from smtplib doesn't support CC.
If i add a "list" of recipients like ["name@email.com", "surename@email.com"] it will all add them to "To" field.

EDIT:
Ahhhhhhhh, i get it now!!
If i form the headers like i did in first email, but pass a list of recipients to sendmail() it will actually work!
Thanks Zhang!!