Muokkaa

Jaa


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

[AMENDMENT]
class SMTPEventConsumer : __EventConsumer
{
  uint8  CreatorSID[];
  string MachineName;
  uint32 MaximumQueueSize;
  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-only

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-only

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.

CreatorSID

Data type: uint8 array

Access type: Read-only

Security identifier (SID) that uniquely identifies the user who creates a filter. WMI stores the SID of the user who creates an instance of __EventConsumer or the Administrator SID, depending on the operating system. For more information, see Binding an Event Filter with a Logical Consumer and Monitoring and Responding to Events with Standard Consumers.

This property is inherited from __EventConsumer.

FromLine

Data type: string

Access type: Read-only

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".

HeaderFields

Data type: string array

Access type: Read-only

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

MachineName

Data type: string

Access type: Read-only

Name of the computer to which Windows Management Instrumentation (WMI) sends events.

This property is inherited from __EventConsumer.

MaximumQueueSize

Data type: uint32

Access type: Read-only

Maximum queue for a specific consumer, in bytes.

This property is inherited from __EventConsumer.

Message

Data type: string

Access type: Read-only

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

Name

Data type: string

Access type: Read-only

Qualifiers: key

Unique identifier for the event consumer.

ReplyToLine

Data type: string

Access type: Read-only

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-only

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-only

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

ToLine

Data type: string

Access type: Read-only

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

Requirement Value
Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008
Namespace
Root\subscription
MOF
Smtpcons.mof
DLL
Smtpcons.dll

See also

__EventConsumer

Standard Consumer Classes

Sending Email Based on an Event

Creating a Logical Consumer

Receiving Events At All Times