These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Email button and setting subject heading

Anonymous
Answered

Hi all,

is it possible to create a script for an email button that will have a default subject heading that i want, and also can i get the address to send it too from a field on the pdf.

For example, i have a PDF that has "Joe Bloggs" details on! On the PDF, under a field called "Email" it has his email address "Jo@123", how can i send the form to him at the that address with a subject heading called "Hello".

Any help to any of them would be greatly appreciated!

Thank you

My Product Information:
Acrobat Standard 9.1.3, Windows
suewhitehead
Registered: Jun 3 2008
Posts: 232
You can use this script, just change the name of the field where the email address is the value. Then put in the subject as you would like it, etc.

I have mine on a list field named CCList with the name showing and the export value has the email address already in the field. But you could use a text field into which the email has been entered.

var address = this.getField("CCList").value
var sub = "Complaint Disposition form";
var msgBody = "Attached is the Complaint Disposition form.";
var cResponse = app.alert({
cMsg: "To email this form, select email addresses from the EMAIL FORM TO list. Hold CTRL to select multiple addresses. \n\nYou will be able to add other email addresses after you click YES.\n\nProceed?\n\nClick YES to proceed.\nClick NO to go back and select addresses.",
nIcon: 2, nType: 2,
cTitle: "Email Form"});
// proceed only if response is "YES"
if (cResponse == 4) {
this.mailDoc({
bUI: false,
cTo: address,
cSubject: sub,
cMsg: msgBody,
cSubmitAs: "PDF"
});
}
smitchell15 (not verified)
Fantastic, that is brilliant and worked a treat, thank you again, been struggling on that one! Also one last thing my script is below which is exactly the same as yours bar one line the subject, i can populate that the same way as the thisgetField method but is there away i can add the word INVOICE before the "Invoice" data from the field

var address = this.getField("CCList").value
var sub = this.getField("Invoice").value;
var msgBody = "Attached is your invoice....";
var cResponse = app.alert({
cMsg: "PDF sent to outlook...",
nIcon: 2, nType: 2,
cTitle: "Email Form"});
// proceed only if response is "YES"
if (cResponse == 4) {
this.mailDoc({
bUI: false,
cTo: address,
cSubject: sub,
cMsg: msgBody,
cSubmitAs: "PDF"
});
}
John Grand
Registered: Aug 18 2009
Posts: 18
This is a great example. It's exactly what I would like to do on my first form. Being a complete novice I have tried attaching the code to a "submit by email button" or should it be a regular button?

I have the CCList field as a text field. I am getting the following error.


Error: Invalid property get operation; field doesn't have property 'getField'
PDF generated successfully.

1 warnings/errors reported

Any suggestions or examples would be helpful


Thank You
smitchell15 (not verified)
Hi

Yea try just creating a normal button and in the actions tab, choose "run a javascript" and enter the following script in there

Is that where your trying it? And have you changed the 'var sub' values?
John Grand
Registered: Aug 18 2009
Posts: 18
I am using a Livecycle form just for practice. I have added some fields to match yours just to see if I can get the technique to work.

* when you setup the regular button did you select regular, execute, or submit?
smitchell15 (not verified)
Hi again, checked out the script yesterday in LiveCycle but unfortunately it didn't work either. I built the form from Acrobat as no that inside out but have very little knowledge on LiveCycle as i mainly work on a Mac. Sorry but maybe if you post the question again someone could help you. It looks like you just need to modify the code a bit, but i wouldn't have a clue where to start!