Thanks ejsolutions,
I managed to solve, actually the configuration was already correct, I just needed to restart the OpenDKIM service.
In my /etc/postfix/main.cf I added these lines:
smtpd_milters = inet:127.0.0.1:8891
non_smtpd_milters = inet:127.0.0.1:8891
milter_default_action = accept
milter_protocol = 2
@AlnorkA
I said mail() function, but I actually use Wordpress for my websites and I think it already uses PHPMailer for sending email, anyway I don't use SMTP authentication but still it works and emails are signed correctly, so it IS possible.