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

Email Submit button to one external address

Avatar

Level 2

When I add an email Submit Button it only comes to me as the creator of the form.

I would like it to go to another external Sales email address only.

I have looked on line and have found some other scripts but they don't do exactly what I am looking for.

Script I have used goes to an external but also to me along with providing additional inputs.

I have tried to remove the additional inputs but then the script doesn't work.

Help on this issue would be appreciated.

1 Accepted Solution

Avatar

Correct answer by
Level 3

Sorry for the delay, but participating here in the forums comes after family, work, eating and sleeping, so sometimes it takes a bit longer until I can reply

I assume this is happening in the free Reader. The reason for this is that even though recent versions of the free Reader can fill and save AcroForms (the type of form you create in Adobe Acrobat), XFA forms (the ones created in LiveCycle Designer) are not supported by this "free" feature. You will have to reader-enable your form in Adobe Acrobat. In Acrobat DC for example, you would select File>Save As Other>Reader Extended PDF>Enable More Tools. Once you've done that, you should be able to fill and save in both Acrobat and the free Reader.

View solution in original post

50 Replies

Avatar

Level 3

Have you tried using two email addresses when you configure your email button?

user1@example.com;user2@example.com

This should work in most browsers and email applications. I know that Outlook is picky and only allows the semicolon between the two email addresses, other applications allow a comma as well.

Avatar

Level 2

Karl,

Currently I am starting from scratch using the default Submit by Email button.

I have looked at several on line and tried a few but have had varying success.

What I am trying to do:

This PDF document will be sent to a Customer or placed on a Web page so they can fill it in to order products.

Once they hit the Submit Email button we would like it to return to a general Sales email address.

Currently it only returns to myself as the creator of the form.

I am not looking for a pop up card to be filled in each time.

Below is one of the scripts I have been looking at.

// This is the form return e-mail. Its hardcoded

// so that the form is always returned to the same address

// Change address on your form

var cToAddr = "sales@123.com";

// First, get the client CC e-mail address

// var cCCAddr = this.getField(“ClientEmail”).value;

// Now get the beneficiary e-mail only if it is filled out

// var cBenAddr = this.getField(“BennyEmail”).value; if(cBenAddr != “”) cCCAddr += “” + cBenAddr;

// Set the subject and body text for the e-mail message

// var pn = this.getField(“1.2.polisnummer”).value;

// var cSubLine = “Form X-1 returned from client” + pn;

// var cBody = “Thank you for submitting your form.\n” + “Save the mail attachment for your own records”;

// Send the form data as an PDF attachment on an e-mail

this.mailDoc();

Dean Robinson

Avatar

Level 2

Karl,

Didn’t know if this would be helpful to you or not.

LiveCycle settings indicating email address below.

Dean Robinson

Avatar

Level 3

You are using a script that was made for AcroForms in a LiveCycle form. That will in most cases not work without some modifications. I've used the script you've quoted and made some modifications so that it should work in LiveCycle:

// This is the form return e-mail. Its hardcoded

// so that the form is always returned to the same address

// Change address on your form

var cToAddr  = "sales@123.com";

// First, get the client CC e-mail address

var cCCAddr = xfa.resolveNode("ClientEmail").rawValue;

console.println("Client: " + cCCAddr);

// Now get the beneficiary e-mail only if it is filled out

var cBenAddr = xfa.resolveNode("BennyEmail").rawValue;

console.println("Benny: " + cBenAddr);

if(cBenAddr != "")

    cCCAddr += ";" + cBenAddr;

// Set the subject and body text for the e-mail message

var pn = xfa.resolveNode("polisnummer").rawValue;

var cSubLine = "Form X-1 returned from client " + pn;

var cBody = "Thank you for submitting your form.\nSave the mail attachment for your own records";

// Send the form data as an PDF attachment on an e-mail

event.target.mailDoc({

      bUI: false,

      cTo: cToAddr,

      cCc: cCCAddr,

      cSubject: cSubLine,

      cMsg: cBody,

  });

Avatar

Level 2

Karl,

I have dropped script below into Mouseup, Saved and released.

When I fill in the form and push the Submit by Email button I get all the forms but nothing goes to the Sales@123.com<mailto:Sales@123.com>.

Should there be something else I need to do to make this work?

Dean

Avatar

Level 3

What exactly do you mean "I get all the forms"? When you click on the submit button, do you get a dialog that asks you about how to submit the email? If not, does your email application launch?

Can you send emails from other PDF forms?

Avatar

Level 2

Karl,

When I click the Submit button it automatically launches.

I receive a copy of the filled out form but it doesn’t get sent to the Sales email.

I tried to submit several time so I received all the forms (3 copies) but no copies sent to the Sales email.

Avatar

Level 3

What email application are you using?

Avatar

Level 2

Outlook Wundows365

Sent from my Verizon Wireless 4G LTE Droid

Avatar

Level 3

When you look at the email header of the email that you receive, what is in the "CC:" line? Does it also fail if you only have one email address in the "CC" line (meaning, you are not specifying a beneficiary email address)?

Avatar

Level 3

Are you getting any errors on the JavaScript console (Ctrl-J or Cmd-J)? Is it possible that the field names I am using are different than the ones you are using?

Avatar

Level 2

Karl,

I have changed the email to the correct address as shown, ClientEmail (all one word matches field as shown)

Email is set to auto send.

No BennyEmail field

// This is the form return e-mail. Its hardcoded

// so that the form is always returned to the same address

// Change address on your form

var cToAddr  = "[address redacted]";

// First, get the client CC e-mail address

var cCCAddr = xfa.resolveNode("ClientEmail").rawValue;

console.println("Client: " + cCCAddr);

// Now get the beneficiary e-mail only if it is filled out

var cBenAddr = xfa.resolveNode("BennyEmail").rawValue;

console.println("Benny: " + cBenAddr);

if(cBenAddr != "")

    cCCAddr += ";" + cBenAddr;

// Set the subject and body text for the e-mail message

var pn = xfa.resolveNode("polisnummer").rawValue;

var cSubLine = "Form X-1 returned from client " + pn;

var cBody = "Thank you for submitting your form.\nSave the mail attachment for your own records";

// Send the form data as an PDF attachment on an e-mail

event.target.mailDoc();

Screen shot of incoming email, no CC shown below. (No Client email specified)

When I use my own email address in the Client Email field I still only get one copy as shown below.

Avatar

Level 2

You are replying to a public forum. Don't include private information and please turn off your email signature.

Avatar

Level 3

You need to specify parameters to the Doc.mailDoc() function. See the code that I provided for the correct syntax.

Avatar

Level 2

Karl,

Not sure I follow, the Mail Doc info is as you have indicated, shown below.

// Send the form data as an PDF attachment on an e-mail

event.target.mailDoc();

Dean R

Avatar

Level 3

Maybe the forum system is removing information - do you have anything between "(" and ")"?

This is copied from my original post:

event.target.mailDoc({ 

      bUI: false

      cTo: cToAddr, 

      cCc: cCCAddr, 

      cSubject: cSubLine, 

      cMsg: cBody,

})

Avatar

Level 2

Karl,

Below is a screen shot of exactly what is being used, with exception to the actual Sales email address.

Dean R

Avatar

Level 3

There is no screenshot attached to your reply. You cannot attach images when replying via email. Just log into the forums system and then use the "Insert Image" button:

2017-04-25_13-19-06.png