Re: Milters and notification on DISCARD

2016-11-27 Thread Stavros Tsolakos
Hi.

> Including spamming innocent people with notifications for email
> that they did not send.

You are right, but in my case it is about blocking sending to people
outside a local 'ecosystem'. So spamming is quite unlikely since there
are no relay servers configured either.

Anyway, thank you for your help.

Stavros



Re: Milters and notification on DISCARD

2016-11-27 Thread Wietse Venema
Stavros Tsolakos:
> > What is the nature of the client? If it is an MTA, then it must
> > return a message to sender; if it is an MUA, then don't count on
> > such clients to put a non-delivery notice in the sender's inbox.
> 
> Yes, it is a MUA. Several MUAs actually: a Rainloop webmail client, a
> CLAWS mail client etc. All report that they failed to queue the message,
> which is exactly what I wanted to happen. Is there a trigger for postfix
> to send a custom failure notice email to the sender when this happens?

No. I suppose there is no trigger for MUA clients to leave unsent
email in the user's inbox, or to report the server's response.

There is a one-bit 'can bounce' flag in the Postfix cleanup server
to create an NDR for email that is picked up from the Postfix
sendmail command, but I don't think that it is a good idea to set
that flag for email received via SMTP. Better get the clients fixed
to report the server response to the user.

> Alternatively, I could do it myself from the milter's code i.e. call the
> sendmail program to do the job. Actually, this can make things as
> flexible as needed.

Including spamming innocent people with notifications for email
that they did not send.

Wietse


Re: Milters and notification on DISCARD

2016-11-27 Thread Stavros Tsolakos
Hi.

> What is the nature of the client? If it is an MTA, then it must
> return a message to sender; if it is an MUA, then don't count on
> such clients to put a non-delivery notice in the sender's inbox.
> 

Yes, it is a MUA. Several MUAs actually: a Rainloop webmail client, a
CLAWS mail client etc. All report that they failed to queue the message,
which is exactly what I wanted to happen. Is there a trigger for postfix
to send a custom failure notice email to the sender when this happens?
Alternatively, I could do it myself from the milter's code i.e. call the
sendmail program to do the job. Actually, this can make things as
flexible as needed.

Thank you,

Stavros



Re: Milters and notification on DISCARD

2016-11-27 Thread Wietse Venema
Stavros Tsolakos:
> milter-reject: END-OF-MESSAGE from localhost[127.0.0.1]: 4.5.1 Rejected
> because I said so;

What is are Milter call and arguments that send the response?

> "Rejected because I said so" is a test reason I have written. Still, the
> client reports a failure but no failure message appears in the sender's
> inbox.

What is the nature of the client? If it is an MTA, then it must
return a message to sender; if it is an MUA, then don't count on
such clients to put a non-delivery notice in the sender's inbox.

Wietse


Re: Milters and notification on DISCARD

2016-11-27 Thread Stavros Tsolakos
Hi.

>> I have tried REJECTing it, however sending just failed without further
>> explanation for the user, although the reason appeared fine in the log
>> file. To avoid client specific issues, I would need something similar to
>> the undeliverable mail notifications emails sent to the sender's mailbox.
> 
> At which SMTP protocol stage are you issuing the REJECT response?
> Try rejecting at end-of-data.

This is what I am doing (return a REJECT at the end of the body).

I am getting this line in the log file:

milter-reject: END-OF-MESSAGE from localhost[127.0.0.1]: 4.5.1 Rejected
because I said so;

"Rejected because I said so" is a test reason I have written. Still, the
client reports a failure but no failure message appears in the sender's
inbox.

Of course I am doing something wrong due to my rookieness, but how may I
troubleshoot it?

Thanks,

Stavros



Re: Milters and notification on DISCARD

2016-11-27 Thread Wietse Venema
Stavros Tsolakos:
> Hi list.
> 
> I am really new to postfix and email-under-the-hood in general.
> 
> I have written a milter which in some cases DISCARDs the message, so
> that it may not be sent at all. Is there a way of making postfix notify
> the sender that their email was discarded?

Yes, it is called REJECT.

> I have tried REJECTing it, however sending just failed without further
> explanation for the user, although the reason appeared fine in the log
> file. To avoid client specific issues, I would need something similar to
> the undeliverable mail notifications emails sent to the sender's mailbox.

At which SMTP protocol stage are you issuing the REJECT response?
Try rejecting at end-of-data.

Wietse


Milters and notification on DISCARD

2016-11-27 Thread Stavros Tsolakos
Hi list.

I am really new to postfix and email-under-the-hood in general.

I have written a milter which in some cases DISCARDs the message, so
that it may not be sent at all. Is there a way of making postfix notify
the sender that their email was discarded?

I have tried REJECTing it, however sending just failed without further
explanation for the user, although the reason appeared fine in the log
file. To avoid client specific issues, I would need something similar to
the undeliverable mail notifications emails sent to the sender's mailbox.

Thank you very much!

Stavros

PS: I am using Postfix 2.6.6 on an old CentOS 6.8 x64