Poco::Net

class SMTPChannel

File Information

Library: Net
Package: Logging
Header: Poco/Net/SMTPChannel.h

Description

This Channel implements SMTP (email) logging.

Inheritance

Direct Base Classes: Poco::Channel

All Base Classes: Poco::Channel, Poco::Configurable, Poco::RefCountedObject

Member Summary

Member Functions: close, getProperty, log, open, registerChannel, setProperty

Inherited Functions: close, duplicate, getProperty, log, open, referenceCount, release, setProperty

Types Aliases

Ptr

using Ptr = Poco::AutoPtr < SMTPChannel >;

Constructors

SMTPChannel

SMTPChannel();

Creates a SMTPChannel.

SMTPChannel

SMTPChannel(
    const std::string & mailhost,
    const std::string & sender,
    const std::string & recipient
);

Creates a SMTPChannel with the given target mailhost, sender, and recipient.

Destructor

~SMTPChannel protected virtual

~SMTPChannel();

Member Functions

close virtual

void close();

Closes the SMTPChannel.

getProperty virtual

std::string getProperty(
    const std::string & name
) const;

Returns the value of the property with the given name.

log virtual

void log(
    const Message & msg
);

Sends the message's text to the recipient.

open virtual

void open();

Opens the SMTPChannel.

registerChannel static

static void registerChannel();

Registers the channel with the global LoggingFactory.

setProperty virtual

void setProperty(
    const std::string & name,
    const std::string & value
);

Sets the property with the given value.

The following properties are supported:

  • mailhost: The SMTP server. Default is "localhost".
  • sender: The sender address.
  • recipient: The recipient address.
  • local: If true, local time is used. Default is true.
  • attachment: Filename of the file to attach.
  • type: Content type of the file to attach.
  • delete: Boolean value indicating whether to delete the attachment file after sending.
  • throw: Boolean value indicating whether to throw exception upon failure.

Variables

PROP_ATTACHMENT static

static const std::string PROP_ATTACHMENT;

PROP_DELETE static

static const std::string PROP_DELETE;

PROP_LOCAL static

static const std::string PROP_LOCAL;

PROP_MAILHOST static

static const std::string PROP_MAILHOST;

PROP_RECIPIENT static

static const std::string PROP_RECIPIENT;

PROP_SENDER static

static const std::string PROP_SENDER;

PROP_THROW static

static const std::string PROP_THROW;

PROP_TYPE static

static const std::string PROP_TYPE;

Securely control IoT edge devices from anywhere   Connect a Device