Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Email script

ashr1971
Level 3
Level 3

Just a simple javascript to send a form via email,thats all I need ,lol

0 Replies
Mandy_Wiesener
Level 5
Level 5

You could use the following. You could use field entries, then you have to change the path and the objectname to yours.

var Mailto = Formular1.s1.email.rawValue;


You could use static text

var Mailto = "test@test.de";


It's your choice.


//fill in e-mail

var Mailto = Formular1.s1.email.rawValue;

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

//fill in subject

var Betreff = Formular1.s1.betreff.rawValue;

//var Betreff = "Test-Betreff";

//fill in message

var Nachricht = "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=" + Betreff + "&Body=" + Nachricht + "&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 hope that will helps?

Mandy

Mandy_Wiesener
Level 5
Level 5

You could also use the following:

  1. Take a submit-button.
  2. Fill in the emailadress.
  3. Fill in the subject.
  4. Select "submit as" XML or PDF.

submit.jpg

I hope one of the both will helpful?

Kind regards Mandy

ashr1971
Level 3
Level 3

Thank you for this.

What does Nachricht and betreff mean?Also,how do I add a field from the form to the subject line?

Thanks!!!

Mandy_Wiesener
Level 5
Level 5

Sorry. I come from Germany. This is the german word for message.

Nachricht = Message

Betreff = Subject

I forgot to change this.

But this is only a variable..

You can work with them?

ashr1971
Level 3
Level 3

Hi and thank you.

Is there a way to display a message right after the submit button is clicked and before the email client opens?

Thanks!!!!

Mandy_Wiesener
Level 5
Level 5

For which reason?

You want check if the message is correct?

ashr1971
Level 3
Level 3

A simple message like thank you for submitting the form.

Mandy_Wiesener
Level 5
Level 5

You can solve this about the

xfa.host.messabeBox(Nachricht, "Information for user.", 1, 0);

FrankB2
Level 1
Level 1

Hi, this is great info for me as I've been trying to manage a BUTTON to send out an email strictly as a PDF file.  The attached form needs to be in the name the form was initially saved.  I'm using your example below but it is sending the PDF form as an XML file.  My problem is I'm not sure what type of "Control Type" button under the "Field" object I should use and I want to make sure that form sent is 1) In the name of the form being sent, and 2) is being sent as a PDF file.  Thanks for your help...

  1. //cSubmitAs: "PDF" send the pdf as attachment 
  2. //cSubmitAs: "XML" send the pdf as xml-attachment 
  3. event.target.submitForm({ 
  4. cURL: Mail, 
  5. bEmpty: true, 
  6. cSubmitAs: "XML" 
  7. });