select mail.* from projekt join mapping using (project_id) left join mails using (mail_id) where mapping.type='auto'