Loading...
Searching...
No Matches
MailMessage::Attachment Class Reference

class representing a MIME Attachment for the Message More...

Inheritance diagram for MailMessage::Attachment:
[legend]

## Public Member Functions

| add (MultiPartMixedMessage mpm)
| adds itself to a multipart/mixed message
| constructor (string name, string mime, data part_data, string enc=EncBase64, *hash< auto > hdr)
| creates an Attachment object for a Message object
Public Member Functions inherited from MailMessage::Part
| add (MultiPartAlternativeMessage mpa)
| adds itself to a multipart/alternative message
data | getData ()
| returns the data of the Part
*hash< auto > | getHeaders ()
| returns any headers for the Part
hash< auto > | getInfo ()
| Returns information about the part.
string | getMime ()
| returns the mime type of the Part
string | getName ()
| returns the name of the Part
string | getTransferEncoding ()
| returns the transfer encoding of the Part

## Detailed Description

class representing a MIME Attachment for the Message

this class wraps all the data for the attachment, including:

- the attachment's name; ie the file name which will be shown
- the mime type of the Attachment (ex: MimeTypeJpeg ie `"image/jpeg"`)
- the data for the attachment; either binary object or as a string
- the encoding type for the attachment

Example:
  File f();
  f.open2("file.jpg");
  Attachment att("file.jpg", MimeTypeJpeg, f.readBinary(-1));
  f.close();
  msg.attach(att);

## Member Function Documentation

## constructor()

MailMessage::Attachment::constructor | ( | string | name,
|  | string | mime,
|  | data | part_data,
|  | string | enc = EncBase64,
|  | *hash< auto > | hdr )

creates an Attachment object for a Message object

Parameters

  name | the name of the attachment to be displayed in the message, normally a file name without any path
  mime | the mime type for the message
  part_data | the attachment data itself
  enc | the encoding type for the message (see Message Encodings for possible values)
  hdr | optional headers for the MIME part for the attachment

Exceptions

  UNKNOWN-ENCODING | the message encoding value passed is unknown/unimplemented
  INVALID-ENCODING | the encoding given cannot be used with data given