WriteSMTP

Sends an email message via an Simple Mail Transfer Protocol (SMTP) server, a protocol for sending email messages between servers.

The message can be sent with an image attached. Optionally, the image file may be a complete screen capture, including overlay graphics on top of the image.

CAUTION:  Do not reference this function to an event that triggers with high frequency, such as continuous image acquisition; the mail server may become overloaded with messages.
Note:
  • The cell state of the WriteSMTP function must be referenced to an Event or Button function. For more information, see Cell State Dialog.
  • The WriteSMTP function requires the In-Sight sensor to be Online.
  • If a memory-intensive job containing the function is executed repeatedly, the FTP command "Get image.jpg" (or .bmp) may fail because the vision system's memory becomes too fragmented. The job will continue to execute correctly.
  • Jobs containing this function that are saved in In-Sight Explorer 3.3.0 or higher are only compatible with In-Sight Explorer 3.3.0 and higher.

WriteSMTP Inputs

Syntax: WriteSMTP(Event,SMTP Mail Server,To,Cc,From,Subject,Importance,Image Attachment,Image Name,Image Format,Screen Capture,Message Text,Message Text,Message Text,Message Text)

Parameter Description

Event

Specifies the event that forces an update.This parameter must be a reference to one of the following:
  • The Image data structure in cell A0, containing the AcquireImage function. For more information, see AcquireImage.
  • A cell containing an Event function. For more information, see Event.
  • A cell containing a Button function. For more information, see Button.
Note: When the default Event reference is deleted, the value is replaced by a checkbox. If another cell is referenced as an event, the function will conditionally run based on the referenced cell. If the checkbox is enabled, the function will always run when any inputs to the function are updated.

SMTP Mail Server

Host name or IP address of an SMTP server.

Note:
  • The messages are sent in Multipurpose Internet Mail Extensions (MIME) 1.0 format, a specification for formatting non-ASCII messages so that they can be sent over the Internet. The actual SMTP mail server name or IP address must be referenced.
  • Domain Name Service (DNS) mail exchange (MX) record lookups are not supported. The actual SMTP mail server name or IP address must be referenced. For more information, see Domain Name Service (DNS) Server.
  • When the In-Sight sensor is assigned a static IP address, both the default gateway and the domain must be properly configured. Otherwise, WriteSMTP may fail to send messages. For more information, see Network Settings Dialog.
  • If an invalid Host Name is specified, the connection may take up to 30 seconds to timeout.

To

Email address of the message recipient.

Cc

Email address(es) of any alternate recipients.

From

Sender of the message.

Note: The To, Cc, and From values must be in the format "user@domain", and the domain must be valid.

Subject

Subject text of the message.

Importance

Importance of the message.

  • 0 = Low
  • 1 = Normal (default)
  • 2 = High

Image Attachment

Sends an image as an attachment.

Image Name

File name of the attachment; the default is "Image".

Image Format

File format of the image that will be written out to the target host.

0 = BMP (default) Windows bitmap format (.BMP extension).
1 = JPEG Standard encoded JPEG format (.JPG extension).

Screen Capture

Specifies whether the image will be written to the remote host system with or without any graphic overlays (In-Sight 3400 only).

  • 0 = no graphic overlays (default)
  • 1 = include graphic overlays

Message Text

Specifies the message body text string to be written, or a reference to a cell containing the text. The function allows reference to four cells; each cell can hold up to 254 characters of text.

WriteSMTP Outputs

Returns

An SMTP data structure that will send an email message whenever the spreadsheet is updated.

WriteSMTP Example

WriteSMTP($A$0,"mailserver@yourdomain.com.","recipient@yourdomain.com","copy@yourdomain.com","from@yourdomain.com","Message",1,0,"Image",0,0,"Image Sent", "","","")

Whenever the spreadsheet updates after the referenced Event function activates, this function sends an email message by way of an SMTP mail server. Here is an example of a WriteSMTP property sheet: