Email relay with ColdFusion

cfmail is a built-in Coldfusion tag that is used for local and external email relays. The goal of this article will be to give examples of how this tag can be used.

Using cfmail with the default SMTP gateway

By default, our Coldfusion Cloud services will come with a default SMTP gateway that is able to be used for local scripts. The following cfmail script can be used with the default SMTP:

<cfmail 
to="[email protected]" 
from="[email protected]" 
subject="Example subject">
 
 Your Email Message!!

</cfmail>

Using cfmail with SMTP authentication

In some situation, you may want to use an external email server for SMTP relay and in most cases, this will require SMTP authentication. The below example will show a cfmail script using SMTP authentication:

<cfmail 
to="[email protected]" 
from="[email protected]" 
subject="Example email" 
server="smtp.example.com" 
port="25" 
username="#myUsername#" 
password="#myPassword#">
  
Your Email Message!!
</cfmail>

If you have any questions or encounter issues, please don’t hesitate to reach out to [email protected].