E-Mail with IIS - how it works

Email with IIS/Windows

This description applies to Elements Version 1.
I assume that PHP in the current version 8.4.10 is installed and the following extensions are enabled:

  • php_curl.dll
  • php_fileinfo.dll
  • php_mbstring.dll
  • php_openssl.dll
  1. The .htaccess file must be converted to web.config for IIS.
  2. In the directory /rw/elements/com.realmac.corepack/api, a log directory must be created and the IUSR user must have write permissions in it.
  3. The option “SMTP server does not require authentication” is missing. Therefore, adapt the file ./backend/rw*/config.php (under the contact form). This could be set if no username and password are provided!

/rw/elements/com.realmac.corepack/api/web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <!-- Standard-Dokument -->
    <defaultDocument>
      <files>
        <add value="index.php" />
      </files>
    </defaultDocument>

    <!-- Umschreiben aller Anfragen auf index.php, falls Datei/Verzeichnis nicht existiert -->
    <rewrite>
      <rules>
        <rule name="Rewrite to index.php" stopProcessing="true">
          <match url="^(.*)$" />
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
          </conditions>
          <action type="Rewrite" url="index.php/{R:1}" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

/kontakt/backend/rw094859745987345987345/config.php

<?php

return [
    'email' => [
        'enabled' => '1' === '1',
        'to' => 'to@domain.tld',
        'subject' => 'Subject',
        'template' => 'default',
        'from_email' => 'from@domain.tld',
        'from_name' => 'From Name',
        'smtp_host' => 'smtp.domain.tld',
        'smtp_port' => '25',
        'smtp_username' => '',
        'smtp_password' => '',
        'smtp_encryption' => 'none', // tls, ssl, or none
        'smtp_auth' => false,
        'smtp_timeout' => 30,
        'charset' => 'UTF-8',
    ],
...