Mail binding treaded

Quick question does anyone played with this option. I’m curios to see an example of an id and how do you guys format the asci for this

mailActions.addHeader("Reference", "<unique-thread-identifier>")


I do use that to see resulting mails in a threaded view in mail program, i.e. all mails with the same reference are grouped together.
To achieve this, I put something like “<>”, where different rules use different terms instead of “charging_started”. This means, the reference is not completely dynamic in my case.

I am not 100% aware of the actual rules for such reference, but it seems mail programs do not check too much on that besides the formal “<”, “>” and “@”. To be on the save side you should avoid spaces or special characters…


Internet protocol formats are well document and their spec is available in RFC documents.
In this case you may have a look at RFC 5322 - Internet Message Format to check what is defined resp. recommended.

Well hello thank you but trying i get warnings like missing ) missing " i also read the other comment but if a real example would be nice like Wich i think it should be something like this

mailActions.addHeader("Reference", "<110 111 116 105 102 105 99 97 116 105 111 110 95 49>")

Thing is no matter what I put there it still gets grouped by anyways maybe i don’t get it

Did you put in the numbers by intent or did you put in notification_1 ?

I just put <notification_1>. Example of my rule

rule "Send email with custom header"
    // Trigger the rule when some event occurs
    // For example: Item SomeItem received update
    // Get the email actions for the specified SMTP server
    val mailActions = getActions("mail", "mail:smtp:sampleserver")

    // Add the custom "Reference" header
    mailActions.addHeader("Reference", "<notification_1>")

    // Send the email message
    mailActions.sendMail("", "Test Subject", "Lorem ipsum dolor sit amet, consectetur adipiscing elit.")

    // Log a message to indicate that the email was sent
    logInfo("Email", "Email sent with custom header")