emersion / go-milter

Go library to write mail filters
BSD 2-Clause "Simplified" License
42 stars 19 forks source link

Postfix QID in Milter #27

Open avinash-ghadshi opened 1 year ago

avinash-ghadshi commented 1 year ago

Hi emersion,

Is there any way to get Postfix QID in Milter?

When I send mail using sendmail I get below log in postfix mail log

Jan  3 11:44:49 NL880 postfix/smtpd[596033]: C8D33E07DCF: client=localhost[127.0.0.1]
Jan  3 11:44:49 NL880 postfix/cleanup[596037]: C8D33E07DCF: message-id=<b5iu3af6x5e7.1672726489@test.com>
Jan  3 11:44:49 NL880 postfix/qmgr[584856]: C8D33E07DCF: from=<test@test.com>, size=556, nrcpt=1 (queue active)

I want C8D33E07DCF in Milter Function. Please help!

iredmail commented 1 year ago

Read the postfix doc please: https://www.postfix.org/MILTER_README.html

Isma399 commented 11 months ago

Maybe something like that:

func (s *Session) Header(name string, value string, m *milter.Modifier) (milter.Response, error) {
    if s.queueId == "" {
        s.queueId = m.Macros["i"] + ":"
    }

Postfix seems to wait DATA step to create the queue_id The macros i in Postfix is the queue_id