SMTPEventConsumer class

The SMTPEventConsumer class sends an email message by using Simple Mail Transfer Protocol (SMTP) each time an event is delivered to it. An SMTP server must exist on the network. The SMTPEventConsumer class does not support attachments. The encoding of the email message must be US-ASCII.

This class is one of the standard event consumers that WMI provides. For an example of using SMTPEventConsumer to create a consumer, see Sending Email Based on an Event. For more information, see Monitoring and Responding to Events with Standard Consumers.

The following syntax is simplified from Managed Object Format (MOF) code and includes all of its inherited properties. Properties and methods are in alphabetic order, not MOF order.

Syntax

class SMTPEventConsumer
{
  string BccLine;
  string CcLine;
  string FromLine;
  string HeaderFields[];
  string Message;
  string Name;
  string ReplyToLine;
  string SMTPServer;
  string Subject;
  string ToLine;
};

Members

The SMTPEventConsumer class has these types of members:

Properties

The SMTPEventConsumer class has these properties.

BccLine
Data type: string
Access type: Read/write
Qualifiers: Template

A list of addresses, separated by a comma or semicolon, in the format of a standard string template to which the message is sent as a blind carbon copy. For more information, see the Remarks section of this topic.

CcLine
Data type: string
Access type: Read/write
Qualifiers: Template

A list of addresses, separated by a comma or semicolon, in the format of a standard string template to which the message is sent as a carbon copy. For more information, see the Remarks section of this topic.

FromLine
Data type: string
Access type: Read/write
Qualifiers: Template

From line of an email message in the format of a standard string template. If NULL, a From line is constructed in the form of WinMgmt@MachineName.

Windows Server 2003:  If NULL, FromLine is constructed as "WMI@MachineName". If not NULL, then what is specified in the FromLine property is used, and the consumer sets "WMI@MachineName" as the Sender in the SMTP header of the message. This sender cannot be controlled by any property of the SMTPEventConsumer.

HeaderFields
Data type: string array
Access type: Read/write

Array of header fields that are inserted into an email message without interpretation.

Message
Data type: string
Access type: Read/write
Qualifiers: Template

Standard string template that contains the body of an email message.

Name
Data type: string
Access type: Read/write
Qualifiers: Key

Unique identifier for the event consumer.

ReplyToLine
Data type: string
Access type: Read/write
Qualifiers: Template

Reply-to line of an email message in the format of a standard string template. If NULL, no Reply-to line is used.

SMTPServer
Data type: string
Access type: Read/write
Qualifiers: NotNull

Name of the SMTP server through which an email is sent. Permissible names are an IP address, or a DNS or NetBIOS name. This property cannot be NULL.

Subject
Data type: string
Access type: Read/write
Qualifiers: Template

Standard string template that contains the subject of an email message.

ToLine
Data type: string
Access type: Read/write
Qualifiers: Template

A list of addresses, separated by a comma or semicolon, in the format of a standard string template that identifies where the message is to be sent. For more information, see the Remarks section of this topic.

Remarks

The SMTPEventConsumer class is derived from the __EventConsumer abstract class.

Some of the ToLine, CcLine, or BccLine properties can be NULL, but they cannot all be NULL.

Receiving an error return code from the SMTP service is considered a failure.

Examples

For an example of using SMTPEventConsumer to create a consumer, see Sending Email Based on an Event. For more information, see Monitoring and Responding to Events with Standard Consumers.

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2003

Namespace

\root\subscription

MOF

Smtpcons.mof

DLL

Smtpcons.dll

See also

Standard Consumer Classes
Sending Email Based on an Event
Creating a Logical Consumer
Receiving Events At All Times

 

 

Show:
© 2014 Microsoft