Your JSX Mail project configuration is centralized in the jsx-mail.config.js file, situated at the root of your project. This file is essential for defining project-specific settings for JSX Mail.

Example Configuration File

jsx-mail.config.js
/** @type {import('jsx-mail').JsxMailConfig} */
module.exports = {
  dir: 'mail',
};

This sample configuration file sets the basic parameter dir, indicating the directory where your mail files reside.

Configurable Parameters

You have the flexibility to tailor your jsx-mail.config.js with various parameters to fit your project needs. Below are the available settings you can define:

  • dir: Specifies the directory containing your mail templates. Default is 'mail'.

  • storage: Chooses the storage location for images. Options include S3 for aws s3 storage, LOCAL for local storage and JSX_MAIL_CLOUD for JSX Mail’s default cloud storage. Default is JSX_MAIL_CLOUD.

  • onProcessChange: A callback function triggered during each status update in the prepare command. This function receives details about the current process event and related data.

  • baseImagePath: Just when storage is LOCAL, this parameter is required and allows you to specify a base path for storing images for your rendered template.

  • defaultSender: This parameter allows you to specify a default sender from your JSX Mail Cloud senders for sending emails. If you do not send emails using JSX Mail, this setting is optional. However, if you do send emails, you must either set this parameter or ensure that at least one sender is created in your JSX Mail Cloud. If you do not specify a sender, JSX Mail will automatically use the first available sender from your JSX Mail Cloud. You can set the sender when using the send function by including the sender parameter.

  • AWS Configuration (Used with S3 storage option):

    • awsAccessKeyId: Your Amazon Web Services (AWS) Access Key ID.
    • awsBucket: The AWS bucket designated for image storage.
    • awsFolder: The specific folder within your AWS bucket for storing images.
    • awsRegion: The AWS region for your storage.
    • awsSecretAccessKey: Your AWS Secret Access Key.

These settings allow you to customize the behavior of JSX Mail, ensuring it aligns with your project’s requirements and infrastructure.