To email a pdf copy of a finished form to someone, follow these steps...


  1. Have a datapath on the form that exports to pdf and whose scope is 'server.'
  2. Make sure this server has smtp capabilities
  3. In the .NET script editor, go to the 'AfterDataPathsRun' method
  4. Utilize this code to create an email, attach a pdf, and then send the email...

Try
     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.Attachments.Add(New Attachment(er.ExpandedFilePath))
               End If
          Next

          msg.Body = "Body of Email"
          Dim client As New SmtpClient("localhost", 25)
          client.Send(msg)
          Me.RecordExportResult("Email Participant", True, "", "", "")

      End Using


Catch ex As Exception
      Me.RecordExportResult("Email Participant", False, ex.Message, ex.Message, ex.Message)
End Try 



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.