Setting Up Sendmail for Windows

This documentation should only have to be completed once per development workspace, and it is only necessary for development systems, as production environments will usually already have an email domain setup on the server.

Prerequisites

These directions are for Windows computers only. Currently, we do not have documentation for how to do this on Linux or Mac computers.

Before following this tutorial, the following things should already have been setup:

  • Framework App Dev workspace using XAMPP
  • A Google account with Gmail (you may either use your personal or setup a dummy account just for your Informatics emails)

WAMP setup

This setup is for WAMP only for historical purposes, as we do not use WAMP any more. If you are using XAMPP, skip to the next step.

  • Download Fake Sendmail from here (file should be sendmail.zip)
  • Create a new folder in your wamp folder called sendmail and copy sendmail.exe, sendmail.ini, and all the .dll files from the zip file into the folder.

XAMPP setup

  • As of May 30, 2022 Google no longer allows "Allow Less Secure Apps" as an option, so you must generate an "app password") to use in the sendmail folder in the following way:
    • Turn on 2-factor authentication to your Gmail account: 2-Factor Authentication
    • Make an App Password calling it Sendmail: App Passwords
    • There will be a 16 digit password that pops up -> this will not be saved, so you need to copy it for future steps before you close the popup
  • Edit sendmail.ini in the “sendmail” folder with the following settings:
smtp_server=smtp.gmail.com
smtp_port=465
auth_username=<username>@gmail.com
auth_password=<appPassword>
  • Note that for the last two (auth_username and auth_password), if using a shared computer you may want to clear the username and password when not testing emails, so that no one can send emails from your Gmail account. If you do this, you will have to regenerate an app password every time (unless you save the password in some other way).
  • Navigate back to the XAMPP folder then into bin/php (for WAMP, you will need to select the folder for the PHP version you are using).
  • Edit php.ini (for WAMP it is phpForApache.ini)
  • Find sendmail_path and change it to the following (if using default XAMPP folder, path will be C:\xampp\sendmail\sendmail.exe):
sendmail_path = "<path-to-sendmail> -t"
  • If the line begins with a semicolon (;), remove it. That symbol is used to signify a comment.
  • Start or restart XAMPP.

Gmail setup and usage

Once enabled, all emails should send as normally. Note the “From” email address will always be set to your personal Gmail address instead of what address was set in the FW app.

Further FW Setup

You also need to turn off SMTP for your local setting because it will not work correctly with gmail. Go to your global local.php configuration file (webroot/fw-dev/config/local.php) and add the following value to the return array:

'mail-core' => [
    'config' => [
        'useSmtp' => false
    ]
]

Note: if you already have a mail-core property, just add the config to that array.