Class Poco::Net::SMTPChannel
Author: Applied Informatics Software Engineering GmbH and Contributors

# Poco::Net

# class SMTPChannel

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

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

~SMTPChannel();

## Member Functions

### close

void close();

Closes the SMTPChannel.

See also: Poco::Channel::close()

### getProperty

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

Returns the value of the property with the given name.

See also: Poco::Channel::getProperty()

### log

void log(
const Message & msg
);

Sends the message's text to the recipient.

See also: Poco::Channel::log()

### open

void open();

Opens the SMTPChannel.

See also: Poco::Channel::open()

### registerChannel

static void registerChannel();

Registers the channel with the global LoggingFactory.

### setProperty

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.

See also: Poco::Channel::setProperty()

## Variables

### PROP_ATTACHMENT

static const std::string PROP_ATTACHMENT;

### PROP_DELETE

static const std::string PROP_DELETE;

### PROP_LOCAL

static const std::string PROP_LOCAL;

### PROP_MAILHOST

static const std::string PROP_MAILHOST;

### PROP_RECIPIENT

static const std::string PROP_RECIPIENT;

### PROP_SENDER

static const std::string PROP_SENDER;

### PROP_THROW

static const std::string PROP_THROW;

### PROP_TYPE

static const std::string PROP_TYPE;