# Poco::Net

# class MailStreamBuf

Library: Net
Package: Mail
Header: Poco/Net/MailStream.h

## Description

The sole purpose of this stream buffer is to replace a "\r\n.\r\n" character sequence with a "\r\n..\r\n" sequence for output streams and vice-versa for input streams.

This is used when sending mail messages to SMTP servers, or receiving mail messages from POP servers.

See RFC 2181 (Simple Mail Transfer Protocol) and RFC 1939 (Post Office Protocol - Version 3) for more information.

## Inheritance

Direct Base Classes: Poco::UnbufferedStreamBuf

All Base Classes: Poco::UnbufferedStreamBuf

## Member Summary

Member Functions: close, readFromDevice, readOne, writeToDevice

## Constructors

### MailStreamBuf

MailStreamBuf(
std::istream & istr
);

Creates the MailStreamBuf and connects it to the given input stream.

### MailStreamBuf

MailStreamBuf(
std::ostream & ostr
);

Creates the MailStreamBuf and connects it to the given output stream.

## Destructor

### ~MailStreamBuf

~MailStreamBuf();

Destroys the MailStreamBuf.

## Member Functions

### close

void close();

Writes the terminating period, followed by CR-LF.

### readFromDevice

int readFromDevice();

### readOne

int readOne();

### writeToDevice

int writeToDevice(
char c
);