Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Sending Attachments in an Email from a VI

LabVIEW 8.5 Help
August 2007

NI Part Number:
371361D-01

»View Product Info

You can create a case in a VI that, when executed, sends an email with an attachment from LabVIEW to a list of recipients you specify.

Complete the following steps to create a VI that sends an email with an attachment to a recipient.

  1. Place the SMTP Email Send File VI on the block diagram.
Note  Use the SMTP Email Send Multiple Attachments VI to send multiple attachments to a list of recipients. You can separate addresses with commas or each address can be a separate array element.
  1. Specify the mail server.
    1. Right-click the mail server input and select Create»Constant from the shortcut menu.
    2. In the empty constant, enter the name of the mail server, such as my.mailserver.com. If you are uncertain about the appropriate mail server to use, contact the network administrator to get the name of a valid server.
  2. Specify the recipients of the email.
    1. Right-click the recipients input and select Create»Constant from the shortcut menu.
    2. In the empty array constant, enter the email address or addresses of the recipients you want to receive the email. You can separate addresses with commas or each address can be a separate array element.
  3. Add a subject to the email.
    1. Right-click the subject input and select Create»Constant from the shortcut menu.
    2. In the empty constant, enter a subject for the email. This text appears in the subject line of the email.
  4. Add a message to the email.
    1. Right-click the message input and select Create»Constant from the shortcut menu.
    2. Wire a string to the message input that contains the information you want all recipients to receive.
  5. Attach a file to the email.
    1. Right-click the file path input and select Create»Constant from the shortcut menu.
    2. In the empty path constant enter the path to the file that you want to attach to the email.
    3. If the file you are attaching is binary, complete the following steps. Otherwise, skip to step 7.
      1. Right-click the binary? input and select Create»Constant from the shortcut menu.
      2. Use the Operating tool to click the Boolean constant and change the value to TRUE.
      3. Right-click the MIME content-type input and select Create»Constant from the shortcut menu.
      4. Enter the content-type of the binary file, such as application/octet-stream, and press the <Ctrl-Enter> keys to end text entry. (Mac OS) Press the <Option-Enter> keys. (Linux) Press the <Alt-Enter> keys.
  6. Wire all error in and error out terminals on the block diagram.

Refer to the labview\examples\comm\smtpex.llb for examples of using the SMTP Email VIs.


Resources


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit