To email a pdf copy of a finished form to someone, follow these steps...
Have a datapath on the form that exports to pdf and whose scope is 'server.'
- Make sure this server has smtp capabilities
- In the .NET script editor, go to the 'AfterDataPathsRun' method
Utilize this code to create an email, attach a pdf, and then send the email...
Dim fromAddress As New MailAddress("Sender's Email", "Sender's Name")
Dim toAddress As New MailAddress("Receiver's Email", "Receiver's Name")
Using msg As New MailMessage(fromAddress, toAddress)
msg.Subject = "Subject of Email"
For Each er As ExportResult In _form.Validator.ExportResults
If er.DataPathName = "Name of PDF Datapath" Then
msg.Body = "Body of Email"
Dim client As New SmtpClient("localhost", 25)
Me.RecordExportResult("Email Participant", True, "", "", "")
Catch ex As Exception
Me.RecordExportResult("Email Participant", False, ex.Message, ex.Message, ex.Message)
When the form is finished and the pdf export has been generated, the server will then run this code to send this email with a pdf of the form attached.