Qore Mime Module Reference  1.4.1
 All Classes Namespaces Functions Variables Groups Pages
Mime.qm.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
2 // @file Mime.qm Mime module definition
3 
4 /* Mime.qm Copyright (C) 2012 - 2018 Qore Technologies, s.r.o.
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23 */
24 
25 // minimum required Qore version
26 
27 
28 // assume local var scope, do not use "$" for vars, members, and method calls
29 
30 
136 namespace Mime {
139 
141  public struct MessageInfo {
145  data body;
147  list<hash<MessageInfo>> part();
148  };
149 
151  public struct MessagePartInfo {
156  };
157 
159  public struct FormDataMessageInfo {
161  string name;
163  *string filename;
167  data body;
168  };
169 
176 
178  const MimeTypeOctetStream = "application/octet-stream";
179 
181  const MimeTypeText = "text/plain";
182 
184  const MimeTypeHtml = "text/html";
185 
187  const MimeTypeCsv = "text/csv";
188 
190  const MimeTypeJpeg = "image/jpeg";
191 
193  const MimeTypePng = "image/png";
194 
196  const MimeTypeSoapXml = "application/soap+xml";
197 
199  const MimeTypeYaml = "text/x-yaml";
200 
202  const MimeTypeXml = "text/xml";
203 
205  const MimeTypeXmlApp = "application/xml";
206 
208  const MimeTypeJson = "application/json";
209 
212 
215 
217  const MimeTypeYamlRpc = "application/x-yaml";
218 
220  const MimeTypeJavascript = "application/javascript";
221 
223  const MimeTypeCss = "text/css";
224 
226  const MimeTypeFormUrlEncoded = "application/x-www-form-urlencoded";
227 
229  const MimeTypeMultipartFormData = "multipart/form-data";
230 
232  const MimeTypeMultipartRelated = "multipart/related";
233 
235  const MimeTypeMultipartMixed = "multipart/mixed";
236 
238 
240  const MimeTypes = (
241  "7z": "application/x-7z-compressed",
242  "ai": "application/postscript",
243  "aif": "audio/x-aiff",
244  "aifc": "audio/x-aiff",
245  "aiff": "audio/x-aiff",
246  "asc": MimeTypeText,
247  "atom": "application/atom+xml",
248  "au": "audio/basic",
249  "avi": "video/x-msvideo",
250  "bcpio": "application/x-bcpio",
251  "bin": MimeTypeUnknown,
252  "bmp": "image/bmp",
253  "bz2": "application/x-bzip",
254  "cc": MimeTypeText,
255  "cdf": "application/x-netcdf",
256  "cgm": "image/cgm",
257  "class": MimeTypeUnknown,
258  "cpio": "application/x-cpio",
259  "cpp": MimeTypeText,
260  "cpt": "application/mac-compactpro",
261  "csh": "application/x-csh",
262  "css": MimeTypeCss,
263  "csv": MimeTypeCsv,
264  "dcr": "application/x-director",
265  "dif": "video/x-dv",
266  "dir": "application/x-director",
267  "djv": "image/vnd.djvu",
268  "djvu": "image/vnd.djvu",
269  "dll": MimeTypeUnknown,
270  "dmg": MimeTypeUnknown,
271  "dms": MimeTypeUnknown,
272  "doc": "application/msword",
273  "dtd": "application/xml-dtd",
274  "dv": "video/x-dv",
275  "dvi": "application/x-dvi",
276  "dxr": "application/x-director",
277  "eps": "application/postscript",
278  "etx": "text/x-setext",
279  "exe": MimeTypeUnknown,
280  "ez": "application/andrew-inset",
281  "gif": "image/gif",
282  "gram": "application/srgs",
283  "grxml": "application/srgs+xml",
284  "gtar": "application/x-gtar",
285  "gz": "application/x-gzip",
286  "h": MimeTypeText,
287  "hdf": "application/x-hdf",
288  "hh": MimeTypeText,
289  "hpp": MimeTypeText,
290  "hqx": "application/mac-binhex40",
291  "htm": MimeTypeHtml,
292  "html": MimeTypeHtml,
293  "ice": "x-conference/x-cooltalk",
294  "ico": "image/x-icon",
295  "ics": "text/calendar",
296  "ief": "image/ief",
297  "ifb": "text/calendar",
298  "iges": "model/iges",
299  "igs": "model/iges",
300  "jar": "application/java-archive",
301  "java": MimeTypeText,
302  "jnlp": "application/x-java-jnlp-file",
303  "jp2": "image/jp2",
304  "jpe": MimeTypeJpeg,
305  "jpeg": MimeTypeJpeg,
306  "jpg": MimeTypeJpeg,
307  "js": MimeTypeJavascript,
308  "json": MimeTypeJson,
309  "kar": "audio/midi",
310  "latex": "application/x-latex",
311  "lha": MimeTypeUnknown,
312  "lzh": MimeTypeUnknown,
313  "m3u": "audio/x-mpegurl",
314  "m4a": "audio/mp4a-latm",
315  "m4b": "audio/mp4a-latm",
316  "m4p": "audio/mp4a-latm",
317  "m4u": "video/vnd.mpegurl",
318  "m4v": "video/x-m4v",
319  "mac": "image/x-macpaint",
320  "man": "application/x-troff-man",
321  "mathml": "application/mathml+xml",
322  "me": "application/x-troff-me",
323  "mesh": "model/mesh",
324  "mid": "audio/midi",
325  "midi": "audio/midi",
326  "mif": "application/vnd.mif",
327  "mov": "video/quicktime",
328  "movie": "video/x-sgi-movie",
329  "mp2": "audio/mpeg",
330  "mp3": "audio/mpeg",
331  "mp4": "video/mp4",
332  "mpe": "video/mpeg",
333  "mpeg": "video/mpeg",
334  "mpg": "video/mpeg",
335  "mpga": "audio/mpeg",
336  "ms": "application/x-troff-ms",
337  "msh": "model/mesh",
338  "mxu": "video/vnd.mpegurl",
339  "nc": "application/x-netcdf",
340  "oda": "application/oda",
341  "ogg": "application/ogg",
342  "pbm": "image/x-portable-bitmap",
343  "pct": "image/pict",
344  "pdb": "chemical/x-pdb",
345  "pdf": "application/pdf",
346  "pgm": "image/x-portable-graymap",
347  "pgn": "application/x-chess-pgn",
348  "pic": "image/pict",
349  "pict": "image/pict",
350  "png": MimeTypePng,
351  "pnm": "image/x-portable-anymap",
352  "pnt": "image/x-macpaint",
353  "pntg": "image/x-macpaint",
354  "ppm": "image/x-portable-pixmap",
355  "ppt": "application/vnd.ms-powerpoint",
356  "ps": "application/postscript",
357 
358  // Qore script
359  "q": MimeTypeText,
360 
361  // Qore class include file
362  "qc": MimeTypeText,
363 
364  // Qorus function definition file
365  "qfd": MimeTypeText,
366 
367  // Qorus class definition file
368  "qclass": MimeTypeText,
369 
370  // Qorus constant definition file
371  "qconst": MimeTypeText,
372 
373  // Qorus job definition
374  "qjob": MimeTypeText,
375 
376  // Qore include file
377  "ql": MimeTypeText,
378 
379  // Qore user module source
380  "qm": MimeTypeText,
381 
382  // Qorus service definition
383  "qsd": MimeTypeText,
384 
385  // Qorus workflow definition
386  "qwf": MimeTypeText,
387 
388  "qt": "video/quicktime",
389  "qti": "image/x-quicktime",
390  "qtif": "image/x-quicktime",
391  "ra": "audio/x-pn-realaudio",
392  "ram": "audio/x-pn-realaudio",
393  "ras": "image/x-cmu-raster",
394  "rdf": "application/rdf+xml",
395  "rgb": "image/x-rgb",
396  "rm": "application/vnd.rn-realmedia",
397  "roff": "application/x-troff",
398  "rtf": "text/rtf",
399  "rtx": "text/richtext",
400  "sgm": "text/sgml",
401  "sgml": "text/sgml",
402  "sh": "application/x-sh",
403  "shar": "application/x-shar",
404  "silo": "model/mesh",
405  "sit": "application/x-stuffit",
406  "skd": "application/x-koan",
407  "skm": "application/x-koan",
408  "skp": "application/x-koan",
409  "skt": "application/x-koan",
410  "smi": "application/smil",
411  "smil": "application/smil",
412  "snd": "audio/basic",
413  "so": MimeTypeUnknown,
414  "spl": "application/x-futuresplash",
415  "src": "application/x-wais-source",
416  "sv4cpio": "application/x-sv4cpio",
417  "sv4crc": "application/x-sv4crc",
418  "svg": "image/svg+xml",
419  "swf": "application/x-shockwave-flash",
420  "t": "application/x-troff",
421  "tar": "application/x-tar",
422  "tar.bz2": "application/x-bzip-compressed-tar",
423  "tar.gz": "application/x-tar-gz",
424  "tbz": "application/x-bzip-compressed-tar",
425  "tcl": "application/x-tcl",
426  "tex": "application/x-tex",
427  "texi": "application/x-texinfo",
428  "texinfo": "application/x-texinfo",
429  "text": MimeTypeText,
430  "tgz": "application/x-tar-gz",
431  "tif": "image/tiff",
432  "tiff": "image/tiff",
433  "tr": "application/x-troff",
434  "tsv": "text/tab-separated-values",
435  "txt": MimeTypeText,
436  "ustar": "application/x-ustar",
437  "vcd": "application/x-cdlink",
438  "vrml": "model/vrml",
439  "vxml": "application/voicexml+xml",
440  "wav": "audio/x-wav",
441  "wbmp": "image/vnd.wap.wbmp",
442  "wbmxl": "application/vnd.wap.wbxml",
443  "wml": "text/vnd.wap.wml",
444  "wmlc": "application/vnd.wap.wmlc",
445  "wmls": "text/vnd.wap.wmlscript",
446  "wmlsc": "application/vnd.wap.wmlscriptc",
447  "wrl": "model/vrml",
448  "wsdl": "application/wsdl+xml",
449  "xbm": "image/x-xbitmap",
450  "xht": "application/xhtml+xml",
451  "xhtml": "application/xhtml+xml",
452  "xls": "application/vnd.ms-excel",
453  "xml": MimeTypeXml,
454  "xpm": "image/x-xpixmap",
455  "xsd": MimeTypeXml,
456  "xsl": "application/xml",
457  "xslt": "application/xslt+xml",
458  "xul": "application/vnd.mozilla.xul+xml",
459  "xwd": "image/x-xwindowdump",
460  "xyz": "chemical/x-xyz",
461  "yaml": MimeTypeYaml,
462  "zip": "application/zip",
463  );
464 
466 
472  const UrlEncodedChars = (
473  "\$": True,
474  "-": True,
475  "_": True,
476  ".": True,
477  "!": True,
478  "*": True,
479  "'": True,
480  "(": True,
481  ")": True,
482  ",": True
483  );
485 
489  const ContentTransEnc7Bit = "7bit";
491 
493  const ContentTransEnc8Bit = "8bit";
494 
496  const ContentTransEncBinary = "binary";
497 
499  const ContentTransEncBase64 = "base64";
500 
502  const ContentTransEncQuotedPrintable = "quoted-printable";
503 
505 
507  const MimeBase64LineLen = 76;
508 
510 
514 
518 
524  string mime_encode_base64(data str, int len = MimeBase64LineLen);
525 
526 
528 
531  string mime_encode_quoted_printable(string str, bool hdr = False);
532 
533 
535 
540  data mime_encode_transfer_data(data mime_data, string enc);
541 
542 
544  string mime_encode_header_word_b(string str);
545 
546 
548  string mime_encode_header_word_q(string str);
549 
551 
555 
560  binary mime_decode_base64(data str);
561 
562 
564 
569  string mime_decode_base64_to_string(data str, *string encoding);
570 
571 
573 
578  string mime_decode_quoted_printable(string str, *string encoding);
579 
580 
582 
588  data mime_decode_transfer_data(data mime_data, string enc, *string ct);
589 
590 
592 
595  string mime_decode_header(string hdr);
596 
598 
602  string get_mime_type_from_ext(string path);
604 
605 
607 
622  string mime_get_urlencoded_string(auto val);
623 
624 
626 
641 
642 
644 
653  string mime_decode_urlencoded_string(string str);
654 
655 
657 
668  hash<auto> mime_parse_form_urlencoded_string(string str);
669 
671 
675  const MPT_FORM_DATA = "form-data";
677 
679  const MPT_MIXED = "mixed";
680 
682  const MPT_MESSAGE = "message";
683 
685  const MPT_DIGEST = "digest";
686 
688  const MPT_ALTERNATIVE = "alternative";
689 
691  const MPT_RELATED = "related";
692 
694  const MPT_SIGNED = "signed";
695 
697  const MPT_ENCRYPTED = "encrypted";
698 
700  const MPT_BYTERANGES = "byteranges";
702 
705 
706 public:
707  const MP_DEFAULT_MSG = "This is a MIME multipart message";
708 
710  private :
712  string mptype;
713 
715  string boundary;
716 
718  string ct;
719 
721  list<hash<MessagePartInfo>> l();
722 
724  hash hdr;
725 
726 public:
728 
730 
733  constructor(string mptype, string boundary = MultiPartMessage::getBoundary());
734 
735 
737  binary serialize();
738 
739 
741 
744 
745 
747 
751  int size();
752 
753 
755 
759  string getBoundary();
760 
761 
763 
767  static binary serializeHeaders(hash hdr);
768 
770  static string getBoundary();
771 
773 
777  static string getRandomString(int len);
778 
780 
838  static hash<MessageInfo> parseBody(string boundary, string body, bool decode = True);
839 
841 
845  abstract hash<MessageInfo> getMsgAndHeaders();
846 
848  // don't reimplement this method; fix/enhance it in the module
849 
850 private:
851  final hash<MessageInfo> getMsgAndHeadersIntern(*string content_type, bool conlen = True);
852 public:
853 
854 
855  // don't reimplement this method; fix/enhance it in the module
856 
857 private:
858  splicePartIntern(data mime_data, hash hdr);
859 public:
860 
861 
862  // don't reimplement this method; fix/enhance it in the module
863 
864 private:
865  addPartIntern(data mime_data, hash hdr);
866 public:
867 
868 
869 
870 private:
871  static hash<MessagePartInfo> getPart(data mime_data, hash hdr);
872 public:
873 
875  };
876 
879 
880 public:
882  private :
883  // the starting part ID
884  string startid;
885 
886 public:
888 
890 
892  constructor(string boundary = MultiPartMessage::getBoundary()) ;
893 
894 
896 
903  splicePart(data mime_data, string id, string content_type, *hash hdr);
904 
905 
907 
914  addPart(data mime_data, string id, string content_type, *hash hdr);
915 
916 
918 
922  hash<MessageInfo> getMsgAndHeaders();
923 
924  };
925 
928 
929 public:
931 
933  constructor(string boundary = MultiPartMessage::getBoundary()) ;
934 
935 
937 
949  splicePart(data mime_data, string content_type = MimeTypeText, string disp = "inline", *hash hdr);
950 
951 
953 
965  addPart(data mime_data, string content_type = MimeTypeText, string disp = "inline", *hash hdr);
966 
967 
969 
983  spliceEncodePart(data mime_data, string enc, string content_type = MimeTypeText, string disp = "inline", *hash hdr);
984 
985 
987 
1001  addEncodePart(data mime_data, string enc, string content_type = MimeTypeText, string disp = "inline", *hash hdr);
1002 
1003 
1005 
1009  hash<MessageInfo> getMsgAndHeaders();
1010 
1011  };
1012 
1014 
1017 
1018 public:
1019  private :
1022 
1023 public:
1024 
1026 
1028  constructor(string boundary = MultiPartMessage::getBoundary()) ;
1029 
1030 
1032 
1038  splicePart(data mime_data, string name, *hash hdr);
1039 
1040 
1042 
1050  splicePart(data mime_data, string name, string filename, string content_type, *hash hdr);
1051 
1052 
1054 
1058  splicePart(hash<FormDataMessageInfo> h);
1059 
1060 
1062 
1068  addPart(data mime_data, string name, *hash hdr);
1069 
1070 
1072 
1080  addPart(data mime_data, string name, string filename, string content_type, *hash hdr);
1081 
1082 
1084 
1088  addPart(hash<FormDataMessageInfo> h);
1089 
1090 
1092 
1096  hash<MessageInfo> getMsgAndHeaders();
1097 
1098 
1100 
1109  static hash<string, hash<FormDataMessageInfo>> parseMessage(string content, string body);
1110 
1112 
1116  static MultiPartFormDataMessage makeMessage(hash<string, hash<FormDataMessageInfo>> parts);
1117 
1119 
1123  static binary makeMessageBody(hash<string, hash<FormDataMessageInfo>> parts);
1124 
1126 
1127 private:
1128  checkPartName(string name);
1129 public:
1130 
1131 
1133 
1134 private:
1135  hash getPartHeader(string name, *string filename, *string content_type, *hash hdr);
1136 public:
1137 
1138  };
1139 };
const UrlEncodedChars
hash of non-alphanumeric characters that can be used unencoded in URL encoded format ...
Definition: Mime.qm.dox.h:472
abstract hash< MessageInfo > getMsgAndHeaders()
returns a hash of the message
const MPT_RELATED
for sending multiple components of an aggregated whole (http://tools.ietf.org/html/rfc2387) ...
Definition: Mime.qm.dox.h:691
const MimeTypeJpeg
MIME type for jpeg images.
Definition: Mime.qm.dox.h:190
hash getPartHeader(string name, *string filename, *string content_type, *hash hdr)
builds the header for the part
constructor(string boundary=MultiPartMessage::getBoundary())
creates the object
constructor(string boundary=MultiPartMessage::getBoundary())
creates the object
data data
part body data
Definition: Mime.qm.dox.h:153
const MPT_MESSAGE
for email/MIME messages with headers (http://tools.ietf.org/html/rfc2046)
Definition: Mime.qm.dox.h:682
implements the MultiPartFormDataMessage class, a specialization of MultiPartMessage ...
Definition: Mime.qm.dox.h:1016
string getBoundary()
returns the message boundary string used
constructor(string mptype, string boundary=MultiPartMessage::getBoundary())
creates the object
data body
the data for the message or part
Definition: Mime.qm.dox.h:167
spliceEncodePart(data mime_data, string enc, string content_type=MimeTypeText, string disp="inline", *hash hdr)
adds a message part to the start of the list; encodes the data according to the transfer encoding arg...
string mime_encode_header_word_q(string str)
returns a string in &quot;Q&quot; (&quot;quoted-printable&quot;) encoding for MIME header string words according to RFC 2...
const ContentTransEnc8Bit
implies lines &lt; 1000 chars (= no encoding)
Definition: Mime.qm.dox.h:493
MultiPartMessage class implementation.
Definition: Mime.qm.dox.h:704
const MimeTypeYaml
Mime type for yaml data files.
Definition: Mime.qm.dox.h:199
static hash< MessageInfo > parseBody(string boundary, string body, bool decode=True)
returns a hash representing a parsed multipart message body from a boundary string and body arguments...
const MimeTypeXml
Mime type for plain (human-readable) xml files.
Definition: Mime.qm.dox.h:202
const MPT_ENCRYPTED
for sending encrypted messages (http://tools.ietf.org/html/rfc1847#section-2.2)
Definition: Mime.qm.dox.h:697
hash parts
hash of part names to ensure uniqueness
Definition: Mime.qm.dox.h:1021
parsed form-data message part info
Definition: Mime.qm.dox.h:159
checkPartName(string name)
check for unique part names and adds the part to the unique name hash
string mime_encode_quoted_printable(string str, bool hdr=False)
returns a string in &quot;quoted-printable&quot; (or &quot;QP&quot;) encoding according to RFC 2045 section 6...
static binary serializeHeaders(hash hdr)
serializes a header hash to a binary object
const True
hash< MessageInfo > getMsgAndHeaders()
returns a hash of the message
string mime_get_form_urlencoded_string(hash h)
returns a string in MIME multipart form URL encoded format (for use with &quot;Content-Type: application/x...
string name
the name of the part
Definition: Mime.qm.dox.h:161
implements the MultiPartMixedMessage class, a specialization of MultiPartMessage
Definition: Mime.qm.dox.h:927
const MimeTypeMultipartFormData
Mime type for multipart form data.
Definition: Mime.qm.dox.h:229
const MPT_ALTERNATIVE
for sending multiple &quot;alternatives&quot; of the same content (http://tools.ietf.org/html/rfc2046#section-5...
Definition: Mime.qm.dox.h:688
binary binary()
hash hdr
part header hash
Definition: Mime.qm.dox.h:155
string mime_get_urlencoded_string(auto val)
returns a single string in MIME URL encoded format
const MimeTypeJsonRpc
Mime type for JSON-RPC.
Definition: Mime.qm.dox.h:211
const MPT_BYTERANGES
for sending noncontiguous byte ranges of a single message (http://tools.ietf.org/html/rfc2616) ...
Definition: Mime.qm.dox.h:700
addPart(data mime_data, string name, *hash hdr)
adds a message part to the end of the list
const MimeTypeJson
Mime type for JSON.
Definition: Mime.qm.dox.h:208
const MPT_SIGNED
to attach a digital signature to a message (http://tools.ietf.org/html/rfc1847#section-2.1)
Definition: Mime.qm.dox.h:694
const ContentTransEncBase64
base-64 Content-Transfer-Encoding
Definition: Mime.qm.dox.h:499
binary serialize()
serializes the message with the Content-Type header first and returns a binary object ready to send o...
const MimeTypePng
MIME type for png images.
Definition: Mime.qm.dox.h:193
const MimeQuotedPrintableLineLen
maximum line length for quoted-printable encoding
Definition: Mime.qm.dox.h:512
const False
static hash< string, hash< FormDataMessageInfo > > parseMessage(string content, string body)
parses a multipart/form-data encoded message and returns a hash of its ContentTransEnc7Bit ...
const MimeTypeJavascript
Mime type for Javascript.
Definition: Mime.qm.dox.h:220
const MimeTypeUnknown
MIME type for unknown file types.
Definition: Mime.qm.dox.h:175
hash hdr
message or part headers
Definition: Mime.qm.dox.h:143
string mime_decode_base64_to_string(data str, *string encoding)
returns a string value from a string in &quot;BASE64&quot; encoding according to RFC 2045
const MimeTypeOctetStream
MIME type for unknown file types.
Definition: Mime.qm.dox.h:178
const MimeTypeCss
Mime type for css.
Definition: Mime.qm.dox.h:223
const MimeTypeFormUrlEncoded
Mime type for multipart form URL encoding.
Definition: Mime.qm.dox.h:226
string mime_decode_header(string hdr)
decodes a header string; if any part of the string is encoded with &quot;B&quot; (&quot;BASE64&quot;) or &quot;Q&quot; (&quot;quoted-pri...
const MimeTypeMultipartMixed
Mime type for multipart mixed.
Definition: Mime.qm.dox.h:235
binary mime_decode_base64(data str)
returns a binary value from a string in &quot;BASE64&quot; encoding according to RFC 2045
splicePart(data mime_data, string name, *hash hdr)
adds a message part to the start of the list
const MimeTypeYamlRpc
Mime type for YAML-RPC.
Definition: Mime.qm.dox.h:217
string mime_decode_urlencoded_string(string str)
decodes the given string from URL encoded format
hash< MessageInfo > getMsgAndHeaders()
returns a hash of the message
const MimeTypeXmlRpc
Mime type for XML-RPC.
Definition: Mime.qm.dox.h:214
addEncodePart(data mime_data, string enc, string content_type=MimeTypeText, string disp="inline", *hash hdr)
adds a message part to the end of the list; encodes the data according to the transfer encoding argum...
splicePart(data mime_data, string content_type=MimeTypeText, string disp="inline", *hash hdr)
adds a message part to the start of the list; the data muyst already be encoded and any Content-Trans...
string get_mime_type_from_ext(string path)
returns the mime type for the given filename from the extension or Mime::MimeTypeUnknown if the exten...
message and part info hash
Definition: Mime.qm.dox.h:141
data body
the data for the message or part
Definition: Mime.qm.dox.h:145
const MPT_MIXED
for sending files with different &quot;Content-Type&quot; headers (http://tools.ietf.org/html/rfc2046#section-5...
Definition: Mime.qm.dox.h:679
string mime_encode_base64(data str, int len=MimeBase64LineLen)
returns a string in &quot;BASE64&quot; encoding according to RFC 2045
binary serializeBody()
serializes the message body only and returns a binary object ready to send over a socket ...
message part hash
Definition: Mime.qm.dox.h:151
data mime_encode_transfer_data(data mime_data, string enc)
encodes data according to the given encoding
const MPT_DIGEST
for sending multiple text messages (http://tools.ietf.org/html/rfc2046#section-5.1.5)
Definition: Mime.qm.dox.h:685
const MPT_FORM_DATA
for form data (http://tools.ietf.org/html/rfc1867, http://tools.ietf.org/html/rfc2388) ...
Definition: Mime.qm.dox.h:676
const ContentTransEncQuotedPrintable
quoted-printable Content-Transfer-Encoding
Definition: Mime.qm.dox.h:502
int size()
returns the number of parts in the message
hash hdr
message or part headers
Definition: Mime.qm.dox.h:165
string mime_encode_header_word_b(string str)
returns a string in &quot;B&quot; (&quot;BASE64&quot;) encoding for MIME header string words according to RFC 2047 ...
static MultiPartFormDataMessage makeMessage(hash< string, hash< FormDataMessageInfo >> parts)
creates a multipart/form-data message from a hash of FormDataMessageInfo hashes keyed by part name ...
static string getRandomString(int len)
returns a string of random characters
*string filename
the optional filename for the part
Definition: Mime.qm.dox.h:163
const MimeBase64LineLen
maximum line length for base64 encoding
Definition: Mime.qm.dox.h:507
const MimeTypeHtml
MIME type for HTML.
Definition: Mime.qm.dox.h:184
const MimeTypes
A map of default mime types per file extension; the hash keys are file extensions in lower-case witho...
Definition: Mime.qm.dox.h:240
data mime_decode_transfer_data(data mime_data, string enc, *string ct)
decodes data according to the given encoding
hash hash(object obj)
const MimeTypeSoapXml
Mime type for SOAP XML messages (XML MIME type reference: http://tools.ietf.org/html/rfc3023) ...
Definition: Mime.qm.dox.h:196
const ContentTransEncBinary
binary transfer encoding; implies no maximum line length (= no encoding)
Definition: Mime.qm.dox.h:496
const MimeTypeMultipartRelated
Mime type for multipart related.
Definition: Mime.qm.dox.h:232
static binary makeMessageBody(hash< string, hash< FormDataMessageInfo >> parts)
creates a multipart/form-data message body from a hash of FormDataMessageInfo hashes keyed by part na...
addPart(data mime_data, string content_type=MimeTypeText, string disp="inline", *hash hdr)
adds a message part to the end of the list; the data muyst already be encoded and any Content-Transfe...
const MimeTypeXmlApp
Mime type for more complicated (not human-readable) xml files.
Definition: Mime.qm.dox.h:205
const ContentTransEnc7Bit
default Content-Transfer-Encoding if none is present; implies lines &lt; 1000 chars (= no encoding) ...
Definition: Mime.qm.dox.h:490
const MimeTypeCsv
MIME type for csv files (http://tools.ietf.org/html/rfc4180)
Definition: Mime.qm.dox.h:187
hash< auto > mime_parse_form_urlencoded_string(string str)
returns a hash corresponding to the string in MIME multipart form URL encoded format (for use with &quot;C...
const MimeTypeText
MIME type for text.
Definition: Mime.qm.dox.h:181
list< hash< MessageInfo > > part()
parts of the message or subparts of the part
string mime_decode_quoted_printable(string str, *string encoding)
returns a string parsed from &quot;quoted-printable&quot; (or &quot;QP&quot;) encoding according to RFC 2045 section 6...