How to send custom email from fillable pdf
Hello friends! today we’ll learning how to send custom email from fillable pdf. This is something different from the usual we learn.
Recently I got one requirement to create fillable pdf and add a button to send the filled contents of the pdf as an email body. I’ll be using Soda PDF to achieve that.
Step 1 – Create a fillable pdf
Create the fillable pdf with the fields you want to get information on and name the fields as needed ( as shown in image below).
Step 2 – Add buttons and actions
Add a button from the menu and edit the action ( as shown in image below)
Step 3 – Add java script code to achieve the custom email
Add the JavaScript code by clicking the 3 dots and selecting the JavaScript option.
Step 4 – Java script Code
Add the following JavaScript code and done. The fields values are stored in individual variables.
// To var customEmail = this.getField("toEmail").value; // cc var ccEmail = this.getField("ccEmail").value; // bcc var bccEmail = this.getField("bccEmail").value; // Subject var customSubject = this.getField("Name").value; // Body
var Name = this.getField("Name").value;
var Email = this.getField("Email").value;
var Address = this.getField("Address").value;
var Parts = this.getField("Parts").value;
var Phone1 = this.getField("Phone1").value;
var Phone2 = this.getField("Phone2").value;
var Call = this.getField("Call").value;
var Text = this.getField("Text").value;
// Creating Body
var body = "Name: " + Name + " Phone1: " + Phone1 + "\n" + "Email: " + Email + " Phone2: " + Phone2 + "\n" + "Address: " + Address + " Call: " + Call + " Text: " + Text + "\n" + "Parts Recived: " + Parts + "\n" ;
// Send email this.mailDoc(true, customEmail, ccEmail , bccEmail , customSubject, body);
Keep visiting Analytics Tuts for more tutorials.
Thanks for reading! Comment your suggestions and queries