Qore MailMessage Module Reference 1.3.3
Loading...
Searching...
No Matches
MailMessage::Attachment Class Reference

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

#include <MailMessage.qm.dox.h>

Inheritance diagram for MailMessage::Attachment:
[legend]

Public Member Methods

 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 More...
 
- Public Member Methods 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
 
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
namethe name of the attachment to be displayed in the message, normally a file name without any path
mimethe mime type for the message
part_datathe attachment data itself
encthe encoding type for the message (see Message Encodings for possible values)
hdroptional headers for the MIME part for the attachment
Exceptions
UNKNOWN-ENCODINGthe message encoding value passed is unknown/unimplemented
INVALID-ENCODINGthe encoding given cannot be used with data given