Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Adding CC to email event__click

Avatar

Former Community Member

Hello,

I have been searching for some time to try and find a way (that works) to add email(s) to the CC: line of the email message. I have the following script:

<

event activity="click" name="event__click">

<

script contentType="application/x-javascript">if (Comments.rawValue != null){

RealEmail.event__click.submit.target = "mailto:" + "someone@somewhere.com" + "?cc=" + "someone@somewhere.com" + "?subject=" + "Some subject";

RealEmail.execEvent("click");

} else {

app.alert("Please add comments!");

}

</

script>

</

event>

Which returns the subject line in the CC line along with the email address listed for the CC line.

Does anyone know how to add both the cc and subject to a event__click?

Thanks in advance for any solutions!

Chad

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

The first parameter must be preceded by a ? and all otehrs by a & ...so it will look like this:

= "mailto:" + DropDownList1.rawValue +"?cc=" + fieldname.rawValue + "&subject=" + Subject.rawValue

Paul

View solution in original post

14 Replies

Avatar

Level 7

You can use this language in the Submit to URL field on the Submit tab:

mailto:emailladdress@domaon.com,emailladdress2@domain.com?subject=This is a subject&body=This is the body&cc=emailaddress@domain.com&bcc=emailaddress@domain.com

You need the separating ?'s and &'s for it to work.

Avatar

Former Community Member

This would work if I was using the same email each time, but I am referencing x.rawValue for a few of the email addresses that is collected in the form. I tried to implement the code in the event__click and it didn't work that way.

Thanks for the reply, but I still need help getting it to work with my current requirements.

Avatar

Former Community Member

The property of the submit button is:

RealEmailButton.event__click.submit.target

= "mailto:" + DropDownList1.rawValue + "?subject=" + Subject.rawValue;

You wont be bale to put code on that button so I would hide the real button, then put a fake regular button on the dform. You can script on that one. On the click event adjust the submit.target code to the values that you want. Then use the command:

RealEmailButton.execEvent("click")

to cause the real submit button to click and execute.

Make sense?

Paul

Avatar

Former Community Member

Thanks for the response Paul, but using the information you provided works up until I try to add the email to the CC field.

How would I go about adding CC to the = "mailto:" + DropDownList1.rawValue + "?subject=" + Subject.rawValue; string?

I tried + "?cc=" and + "&cc=" but neither of them work.

Avatar

Level 1

Same issue and question as above.

Avatar

Correct answer by
Former Community Member

The first parameter must be preceded by a ? and all otehrs by a & ...so it will look like this:

= "mailto:" + DropDownList1.rawValue +"?cc=" + fieldname.rawValue + "&subject=" + Subject.rawValue

Paul

Avatar

Level 1

The top of page two is where I used the drop down menu with the fake email button method you detailed in another post.  It creates the email with the attachment and puts the correct email To fine, but I can't get the Cc address part to work.

I tried your code above, but when the email is created it puts the same email from the To also in the Cc.  Take a look.  I'm using Novell GroupWise rather than Outlook.  I'm assuming that may have something to do with it.

Avatar

Former Community Member

Hi Paul,

I have attached the form for your reference. FYI...the submit buttons work on my PC (minus the cc problem I was originally trying to figure out) which has LiveCycle installed on it. When I tried the form from another machine, neither of the submit buttons worked, ARGH!!!

Please take a look at both buttons that are supposed to submit and see if you can figure it out for me.

Thanks for your assistance.

Avatar

Former Community Member

OK, I have the submit issue fixed, but I am still having problems with the CC option. Any assistance is appreciated getting that field to populate...

Avatar

Former Community Member

After a quick look the CC must be in lowercase for the mailto to work.

I will have a closer look later today.

Paul

Avatar

Former Community Member

Hello,

I finally figured it out...using the following script.

<event activity="click" name="event__click">

<script contentType="application/x-javascript">if (UpdateOrDuplicate.rawValue != null){

RealEmail.event__click.submit.target = "mailto:" + EmailField.rawValue + "?cc=" + "someone@somewhere.com" + "&subject= " + SomeField.rawValue + " Any text you want in your subject " + AnyOtherValue.rawValue;

RealEmail.execEvent("click");

} else {

app.alert("Please select from the dropdown box!");

}

</script>

</event>

Thanks everyone for their feedback!

Avatar

Level 1

drizagon - Can you take a look at my attached form above and see if you can get it to work?  I tried copying your script but I still can't get it to work.  I keep getting the same address I chose using the dropdown to fill up both the "To" and CC".  I would be very grateful if you can take a minute to look at it for me.  Thanks

Avatar

Former Community Member

You almost had it acmurdah, you just needed a lower case cc and s for subject. I have attached the working form for you. Enjoy!

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----