TheFox / smtpd

SMTP server (library) for receiving emails, written in pure PHP.
https://fox21.at
MIT License
121 stars 30 forks source link

Required Authentication #13

Open drkhunter opened 6 years ago

drkhunter commented 6 years ago

I've been looking into requiring authentication as per RFC 4954; returning 530 5.7.0 Authentication required on commands other than AUTH, EHLO, HELO, NOOP, RSET, or QUIT.

To do this I've added an "authenticated" status which gets set to true inside the sendAuthSuccessResponse() method (which feels wrong) and checked for this status before running any of the commands requiring auth.

As it stands in 0.7 if the client does not attempt an AUTH it will just accept any of the other commands.

My next question is in the TRIGGER_NEW_MAIL event, how would one access the current authenticated user, for example to save the email to a database against that user.