Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

how to add to and cc fields via email submit button

Avatar

Former Community Member

I have created a form which requires pdf format. I need the form to submit via email with the option to change/select the to: and also add a cc: field with selection as well. Please provide any information available as I am new to livecycle and am not very familiar with script or code.

Thanks!

7 Replies

Avatar

Level 5

You can do the following:

You have to use a normal button!!

//fill in e-mail

var Mailto = Formular1.s1.email.rawValue;

//var Mailto = "test@test.de";

//fill in subject

var SubjectBetreff = Formular1.s1.betreff.rawValue;

//var Betreff = "Test-Betreff";

//fill in message

var MessageNachricht = "Content PDF:\r" + "Field content: " + Formular1.s1.inhalt.rawValue + "\rName: "

+ Formular1.s1.name.rawValue + "\rDatum: " + Formular1.s1.datum.formattedValue;

//var Nachricht = "This is a test message.\r2.row start here.\r3.row here.";

//fill in e-mail cc

var CC = Formular1.s1.emailcc.rawValue;

//var CC = "testcc@test.de";

//fill in e-mail bcc

var BCC = Formular1.s1.emailbcc.rawValue;

//var BCC = "testbcc@test.de";

var Mail = "mailto:" + Mailto + "?Subject=" + SubjectBetreff + "&Body=" + MessageNachricht + "&cc=" + CC + "&bcc=" + BCC;

//cSubmitAs: "PDF" send the pdf as attachment

//cSubmitAs: "XML" send the pdf as xml-attachment

event.target.submitForm({

cURL: Mail,

bEmpty: true,

cSubmitAs: "XML"

});

Hope it will helps you,

Kind regard Mandy

Avatar

Former Community Member

Hi there. Thank you for your reply. I pasted what you sent and I am receiving the following:

The following error was found with the XML source:

xml parsing error: not well-formed (invalid token)(error code 4),

line 772, column 70 of file

The line in question is:

var Mail = "mailto:" + Mailto + "?Subject=" + SubjectBetreff + "&Body=" + MessageNachricht + "&cc=" + CC + "&bcc" + BCC;

(the indicated error site is the "y" in "&Body=")

What do Betreff and Nachricht mean? And what I really need for the "to:" field is to have the option to select a name/email or leave the "to:" field blank so they can type in manually. Could you assist with this?

I appreciate any information!

Thanks,

Avatar

Level 2

Try this.

PDF attached. Just open in LiveDesigner.

udrugasasrcem.com/tocctest.pdf

Avatar

Former Community Member

Hello, thank you for your reply. I believe this what I want but am having difficulties implementing it into my form. I created the "send email" button, to: and cc: fields and pasted the script information but I continue  to receive error codes.

The script issue seems to be quite confusing for me. I am very new to this and would like to know if you could perhaps walk me through this process.

Avatar

Level 2

Can you send me your form please at dariobukovski@yahoo.com so i can take a look at those errors?

Thanks

Avatar

Former Community Member

Thank you so much for your assistance. I have attempted to insert the email addresses but apparently I am doing this incorrectly as I try to test the form and the email addresses do not show up or populate in an email window. It basically does nothing. I have tried numerous ways and still no result.

Could you please instruct me the exact location to enter this information?

Avatar

Level 5

The name if you don't understand is only a name for the variable and is an combination from english and german.

Subject is the english word for Betreff

Message is the english word for Nachricht.

You could use this:

//fill in e-mail

var Mailto = Formular1.s1.email.rawValue;

//var Mailto = "test@test.de";

//fill in subject

var SubjectEmail = Formular1.s1.betreff.rawValue;

//var SubjectEmail = "Test-Subject";

//fill in message

var MessageEmail = "Content PDF:\r" + "Field content: " + Formular1.s1.inhalt.rawValue + "\rName: "

+ Formular1.s1.name.rawValue + "\rDate: " + Formular1.s1.dateEmail.formattedValue;

//var MessageEmail = "This is a test message.\r2.row start here.\r3.row here.";

//fill in e-mail cc

var CC = Formular1.s1.emailcc.rawValue;

//var CC = "testcc@test.de";

//fill in e-mail bcc

var BCC = Formular1.s1.emailbcc.rawValue;

//var BCC = "testbcc@test.de";

var Mail = "mailto:" + Mailto + "?Subject=" + SubjectEmail + "&Body=" + MessageEmail + "&cc=" + CC + "&bcc=" + BCC;

//cSubmitAs: "PDF" send the pdf as attachment

//cSubmitAs: "XML" send the pdf as xml-attachment

event.target.submitForm({

cURL: Mail,

bEmpty: true,

cSubmitAs: "XML"

});

I come from Germany and this is my script (therefore in german) I have try to change the german words in english words...

Here you will find an example: https://workspaces.acrobat.com/?d=4adT3ExjCSsr7HpoDuKq7Q

Helpful?

Mandy