/test.cfm Secret
Created
September 12, 2024 12:02
Using Canonicalize() To Embed Emoji In Email Subject Lines In ColdFusion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
// Subject line with a left-arrow HTML entity and an eyes-emoji HTML entity. | |
subject = "← Hello, is it me you're looking for &##x1f440;?"; | |
// Try sending with embedded HTML entities. | |
sendEmail( subject ); | |
// Try sending with canonicalized HTML entities. | |
sendEmail( canonicalize( subject, false, false ) ); | |
// ------------------------------------------------------------------------------- // | |
// ------------------------------------------------------------------------------- // | |
/** | |
* I send a test email with the given subject line. | |
*/ | |
public void function sendEmail( required string subject ) { | |
cfmail( | |
to = "ben@example.com", | |
from = "no-reply@example.com", | |
subject = subject, | |
type = "text/html", | |
server = "127.0.0.1", | |
port = 1025, | |
spoolEnable = false | |
) { | |
writeOutput( "<h1> Hello There </h1>" ); | |
}; | |
} | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment