GuiDoody
GuiDoody

Reputation: 907

How do I add a JavaMail replyTo in coldfusion?

Using JavaMail I would do something like the following:

...
Address address[] = ...;
Message.setReplyTo(address[]);
...

In ColdFusion, I've tried creating an array and adding an address to the array. I can't just add an address as the method "setReplyTo" takes an Java Address Array of addresses.

I've tried the following (in cfscript):

<cfscript>
...
REPLYTO = createObject("java", "javax.mail.internet.InternetAddress").init("[email protected]", "Joe Schmoe");
replyToArr = arrayNew(1);
arrayAppend(replyToArr,REPLYTO);
msg.setReplyTo(replyToArr);
...
<cfscript>

And also just:

<cfscript>
...
REPLYTO = createObject("java", "javax.mail.internet.InternetAddress").init("[email protected]", "Joe Schmoe");
msg.setReplyTo(REPLYTO);
...
<cfscript>

No bueno. Any suggestions?

Upvotes: 0

Views: 402

Answers (1)

GuiDoody
GuiDoody

Reputation: 907

Nevermind. I was throwing an exception on another line.

It works just to create a coldfusion array, add addresses to the array and then set the replyTo.

<cfscript>
...
REPLYTO = createObject("java", "javax.mail.internet.InternetAddress").init("[email protected]", "Joe Schmoe");
replyToArr = arrayNew(1);
arrayAppend(replyToArr,REPLYTO);
msg.setReplyTo(replyToArr);
...
<cfscript>

Upvotes: 3

Related Questions