# Poco::Net

# class MultipartSource

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

## Description

This is a PartSource for constructing complex mail messages consisting of multiple nested parts.

## Inheritance

Direct Base Classes: PartSource

All Base Classes: PartSource

## Member Summary

Member Functions: addPart, contentTypeWithBoundary, stream

Inherited Functions: filename, getContentLength, headers, mediaType, stream

## Constructors

### MultipartSource

explicit MultipartSource(
const std::string contentType = "multipart/alternative"
);

Creates an empty MultipartSource.

At least one part must be added with addPart().

## Destructor

### ~MultipartSource

~MultipartSource();

Destroys the MultipartSource.

## Member Functions

### addPart

void addPart(
const std::string & name,
PartSource * pSource,
MailMessage::ContentDisposition disposition,
MailMessage::ContentTransferEncoding encoding
);

Adds a part/attachment to the MultipartSource.

The MultipartSource takes ownership of the PartSource and deletes it when it is no longer needed.

The part name, and the filename specified in the part source must not contain any non-ASCII characters. To include non-ASCII characters in the part name or filename, use RFC 2047 word encoding (see encodeWord()).

### stream

std::istream & stream();

See also: Poco::Net::PartSource::stream()

### contentTypeWithBoundary

static std::string contentTypeWithBoundary(
const std::string & contentType
);