Emails is marked as spam

Solution 1:

It sounds like your PHP scripts are not sending the mail using the local MTA, while your Outlook client is. It's that MTA that needs to apply the DKIM signature to each message before it passes to another organization's servers. So, check your PHP configuration and code.

Solution 2:

If I understand right, what is being said is as follows:

  1. PHP (+PEAR MAIL) is installed on a Web Server.
  2. When you send an email through that, it uses the local MTA on the Web server.
  3. Your DKIM signature addition happens in a different MTA.
  4. Therefore PHP DKIM fails while Outlook is ok.

You can compare your Outlook SMTP Server settings with that of PHP and make sure they are the same. If not, make PHP relay through the same SMTP Server used by Outlook.