Of course it's not that simple, I missed at least one line of code. man osmtpd-run:char *username: The username with which the session was successfully authenticated. osmtpd_need needs to be initialized with OSMTPD_NEED_USERNAME. If not available or authentication failed is set to NULL.