Emails

Document Navigation

Emails

Introduction

Cmfive supports two different types of email transports to best suit your needs.

  • The AWS Transport uses various AWS services to make sending email faster and more reliable. Note, to enable the AWS Transport uploads must also stored in S3. See the uploads tutorial for setup.
  • The SwiftMailer transport uses the SwiftMailer library.

AWS Transport

  1. Add the following entries into the config.php file in the root directory of your Cmfive project.
    Config::append("email", [
     "layer" => "aws",
    ]);
    Config::set("admin.mail.aws", [
    "queue_url" => "SQS_QUEUE_URL",
    "region"    => "SQS_QUEUE_REGION",
    ]);
    
  2. If you’re developing on Cmfive locally, also add the following. Note, when system.environment is set to production AWS IAM Roles must be used to authenticate with AWS as this is best practice for security.
    Config::set("admin.mail.aws.credentials", [
     "key"    => "IAM_KEY",
     "secret" => "IAM_SECRET",
    ]);
    Config::set("system.environment", "development");
    
  3. Replace SQS_QUEUE_URL and SQS_QUEUE_REGION with their respective values as well as IAM_KEY and IAM_SECRET if system.environment is set to development.
  4. Make sure to clear your config cache to apply your changes.
  5. Clone the Cmfive-Mail-Service-CDK repository and follow the steps outlined in the README.md file to deploy the CDK stack.

SwiftMailer Transport

  1. Add the following entries into the config.php file in the root directory of your Cmfive project.
    Config::append("email", [
     "layer"    => "smtp",
     "command"  => "",
     "host"     => "EMAIL_HOST",
     "port"     => PORT_NUMBER,
     "auth"     => true,
     "username" => "EMAIL_USERNAME",
     "password" => "EMAIL_PASSWORD",
    ]);
    
  2. Replace EMAIL_HOST, PORT_NUMBER, EMAIL_USERNAME and EMAIL_PASSWORD with their respective values.
  3. Make sure to clear your config cache to apply your changes.