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.

customizing email body on email submit button

Avatar

Level 2

Hi everyone,

I'm trying to modify what the body of the email will look like once the user has pressed an email submit button. In Livecycle designer, I clicked on the button and viewed the xml source. I scrolled down to the following line:

               <submit format="xml" textEncoding="UTF-8" target="mailto:test&test.com?subject=My subject"/>

Then changed it to:

               <submit format="xml" textEncoding="UTF-8" target="mailto:test&test.com?subject=My subject?body=new body"/>

When I tested the button, the text "?body=new body" was appended to the subject line instead of being included in the body itself.
I wondered if anyone could tell lme where I'm going wrong?
Appreciate any help.

20 Replies

Avatar

Former Community Member

When using the mailto the parameters are preceded by a ? and all subsequent parameters are separated

by an &. Also the email address needs an @ not an &. So your command woudl be:

<submit format="xml" textEncoding="UTF-8" target="mailto:test@test.com?subject=My subject&body=new body"/>

Paul

Avatar

Level 2

Thanks for the reply,

I've tried your code however I get the following error:

The following error was found with the XML source:

Xml parsing error: not well-formed (invalid token) (error code 4), line 2430, column 176 of file

Do you know what this means?

Avatar

Level 2

I'm basically trying to remove the default email body that appears when the "submit by email" button is clicked, ie:

The attached file contains data that was entered into a form. It is not the form itself.


The recipient of this data file should save it locally with a unique name. Adobe Acrobat Professional 7 or later can process this data by importing it back into the blank form or creating a spreadsheet from several data files. See Help in Adobe Acrobat Professional 7 or later for more details.

I can't even find the above text in the xml code so I dont' even know how to remove it.

Any further help with these problems, would be much appreciated.

Avatar

Former Community Member

Did you just copy and paste form the forum into the script editor or did you do it some other way?

Paul

Avatar

Level 2

No I didn't copy and paste at all. I just revised the code manually in the code editor. Do you know what the error means?

Avatar

Former Community Member

It looks like you are changing the xml source directly and have introduced an error nstead of using the script editor.  If you send the form to LiveCycle8@gmail.com I will have a look

Paul

Avatar

Level 10

Hi,

if you need an easy way to design the mailTo button you can use my macro for Designer (9.x and 10.x).

It will add a mailTo script to a regular button.

http://thelivecycle.blogspot.com/2011/07/mailto-maker-macro.html

MailTo.png

Avatar

Level 2

Yeah I meant to say that I was editing the xml source, and not using the script editor.

Thanks for agreeing to look at my file which I've sent by email.

Radzmar: thanks also for the link to your macro - I will keep this in my for future projects.

Avatar

Level 1

gwhPoster:

How to fix the problem? What changed?

I need to change the body of the message and not as ...

Please, I need your help.

thanks.

Avatar

Level 2

Hi,

Instead of using the email object from the Custom library, use a regular button and choose "Submit" as the control type. Then in the Submit tab, in the "Submit to url" field, add something like the following:

mailto:test@test.com?subject=Application Form&body=new body

Hope that helps.

Avatar

Level 2

I would love to have this question answered too. Also, does anyone know how to enter returns into the email body text? Currently all I'm able to do is write the body text as one line.

Avatar

Former Community Member

What I ran across in my searching (that worked) was to create hidden fields that contained the data I wanted to use. I also used a "dummy" submit button. The "real" submit button was created as a literal submit button and the following code inserted into the click event of the "dummy" button (which is a Regular button)

This code was modified from another's answer, but does the job. The field "SUBJECT" is set as "Hidden" in the presence drop-down of the object tab. I suspect one could add '&body=' as follows

You would create the field "BODY" and insert the message text and call the formatted value to fill it in. Set the field to "Hidden" so it does not affect your form layout. I am open to being corrected by more experienced scripters (Please and thank you) if I am in error, here.

Avatar

Level 2

Just to clarify, this is generating the email subject or body text and pulling data from the form fields that the end user has filled, correct?

Avatar

Former Community Member

If you choose to use fields the user has filled in, then yes. If you choose to use fields that you have filled and set to hidden, then the user will not see them, but the script WILL and it will use the data contained in them to generate the email subject/body.

Avatar

Level 1

Hello,

For the life of me I can not find this macro to download. The link I click on which is supposed to lead me to the macro does not work. Can you please post a link to the download. Thank you.

(MailTo maker Macro)

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

Level 5

I was unable to get Mandy's script (proceeding entry) to format the email text on a MS Windows Outlook email.  File attached. All the email did was populate in Plain Text.

https://workspaces.acrobat.com/?d=2uxMuZSRHwDGRLzZPoSbXw

Avatar

Level 1

Hello

I tried this option. It works fine. As long as the variable MessageNachricht does not contain an '&' (ampersand). If it does, the text in the body of the email will stop at that '&'.

Does anyone know how to avoid that? How can I change it to include text with '&' in the body of the email? Or it there a way to prevent people from using the '&' in the form (apart from just asking them, of course).

Thanks

Mattias

Avatar

Level 10

I don't see any problems using ampersand characters at my end.

Even rich text values are processed successfully as plain text into the mail subject and body.

I've used a macro to create the mailing script.

It simply picks values from form fields andcombines them together with a default message.

http://thelivecycle.blogspot.de/2012/05/mailto-maker-marco-v1.html