Qore MailMessage Module Reference: MailMessage::Attachment Class Reference

Qore MailMessage Module Reference 1.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Functions Variables Groups Pages
Public Member Functions | List of all members
MailMessage::Attachment Class Reference

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

Inheritance diagram for MailMessage::Attachment:
[legend]

## Public Member Functions
| constructor (string name, string mime, data data, string enc=EncDefault, *hash hdr)
| creates an Attachment object for a Message object More...
Public Member Functions inherited from MailMessage::Part
| add (MultiPartMixedMessage mpm)
| adds itself to a multipart/mixed message
data | getData ()
| returns the data of the Part
*hash | getHeaders ()
| returns any headers for 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:
  my File $f();
  $f.open2("file.jpg");
  my Attachment $att("file.jpg", MimeTypeJpeg, $f.readBinary(-1));
  $f.close();
  $msg.attach($att);

## Member Function Documentation

MailMessage::Attachment::constructor | ( | string | name,
|  | string | mime,
|  | data | data,
|  | string | enc = `EncDefault`,
|  | *hash | 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
  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