Blog

Victor Campos

October 14, 2025

Spread the word


Share your thoughts

Email Configuration with cbMailServices

Introduction

Have you ever accidentally brought your internal email servers down? Or worse, been banned for sending too many emails? Believe me, I’ve been there – and I’ve learned my lesson the hard way. Whether it’s a small typo or sending out thousands of unwanted emails, handling email systems can be tricky.

Luckily, ColdBox has you covered! With the cbMailServices module, you can streamline your email-sending process with ease. Forget about the complexities of the cfmail tag and script; with cbMailServices, you can send mail through various protocols, from email to SMS and even web sockets. Today, we'll dive into configuring this module for seamless email management.


1. Setting Up cbMailServices

ColdBox makes email configuration simple. To begin, you need to configure your ColdBox.cfc file, where you determine the mail settings, including the protocol you want to use. Here’s how to get started:


Example Configuration in ColdBox.cfc:

// config/ColdBox.cfc
mailsettings = {
    // Default token marker for mail body replacements
    tokenMarker = "@",

    // Sending protocol to use
    protocol = {
        class = "cbmailservices.models.protocols.CFMailProtocol",
        properties = {}
    }
};

2. Configuring Different Environments

cbMailServices allows you to easily adjust email behavior based on the environment your application is running in. For example, in production, you’ll likely want to send actual emails. But in development, you may prefer to log emails to a file to avoid flooding inboxes during testing.

Here’s how you can set up environment-specific mail configurations.

Example Environment-Specific Configuration:

// config/ColdBox.cfc
function configure() {
    mailsettings = {
        // CFMail Default Settings
        to      : "info@ortussolutions.com",
        from    : "myapp@sass.io",
        type    : "HTML",
        // Send Protocol
        protocol: {
            class: "cbmailservices.models.protocols.CFMailProtocol"
        }
    };
}

// Development mode: write emails to a log file
function development() {
    mailsettings.protocol = {
        class: "cbmailservices.models.protocols.FileProtocol",
        properties : { filePath : "/logs" }
    };
}

With this setup, emails in the development environment won’t be sent but logged, saving you from accidental email blasts!

3. Customizing Mail Properties

You can go beyond basic configuration and add custom properties. Any extra key you add to the mailsettings struct (that is not part of the standard configuration like tokenMarker or protocol) will be matched directly to the cfmail tag attributes.

For instance, you could add settings like fromto, and type to specify defaults for your emails.

Next Steps

Now that you’ve set up the configuration, you’re ready to send emails efficiently in ColdBox. In the next post, we’ll dive into how to send emails using cbMailServices—including using tokens, building mail bodies, and logging emails in different environments. Stay tuned!

Conclusion

Configuring email systems in ColdBox has never been easier. Whether you're using the default CFMail protocol or customizing your own, the cbMailServices module provides the flexibility and control you need to handle emails efficiently across different environments.


Learn More ColdBox Tips and Tricks

Stay tuned for more ColdBox tips in our ongoing series. if you want to learn more than 10 free tips and tricks make sure to get your “ColdBox 102 tips and tricks book” We have a variety of formats you can choose from.

Get your Copy

Join the Ortus Community

Be part of the movement shaping the future of web development. Stay connected and receive the latest updates on, product launches, tool updates, promo services and much more.

Subscribe to our newsletter for exclusive content.

Follow Us on Social media and don’t miss any news and updates:

Add Your Comment

Recent Entries

Introducing the BoxLang Spring Boot Starter: Dynamic JVM Templating for Spring

Introducing the BoxLang Spring Boot Starter: Dynamic JVM Templating for Spring

Spring Boot developers know the pain of evaluating view technologies. Thymeleaf is great — until you need more expressiveness. FreeMarker is powerful — until the syntax fights you. What if you could write templates in a dynamic JVM language that gives you the full power of the platform, feels natural, and requires zero setup to integrate?

Meet the BoxLang Spring Boot Starter.

Luis Majano
Luis Majano
March 13, 2026
Why Swiss Banks Are Modernizing CFML Platforms Without Rewrites

Why Swiss Banks Are Modernizing CFML Platforms Without Rewrites

The growing need to evolve legacy financial platforms safely

Many Swiss banks and financial institutions still operate important systems built on ColdFusion and CFML platforms.

These systems manage a wide range of functions, including:

  • internal banking workflows
  • reporting systems
  • client portals
  • data integration platforms
  • compliance and risk management tools

In many cases, thes...

Cristobal Escobar
Cristobal Escobar
March 13, 2026
Reactive vs Proactive ColdFusion Support: Why Waiting for an Outage Is the Most Expensive Strategy

Reactive vs Proactive ColdFusion Support: Why Waiting for an Outage Is the Most Expensive Strategy

Many ColdFusion environments operate in a reactive mode without realizing it.

Everything seems fine… until something breaks.

A server crashes.

Performance drops suddenly.

An integration stops working.

A security audit reveals missing patches.

At that point the response is urgent:

“Can someone help us fix this now?”

Emergency support is sometimes unavoidable. But when reactive intervention becomes the norm, it usually means something deep...

Cristobal Escobar
Cristobal Escobar
March 12, 2026