{"id":19535701,"url":"https://github.com/miyako/4d-plugin-gmime","last_synced_at":"2026-05-28T16:31:17.282Z","repository":{"id":147172366,"uuid":"94734370","full_name":"miyako/4d-plugin-gmime","owner":"miyako","description":"Parse MIME using the GMIME library","archived":false,"fork":false,"pushed_at":"2025-10-03T13:20:16.000Z","size":380642,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-03T15:26:37.208Z","etag":null,"topics":["4d-plugin","mime"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/miyako.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-19T03:49:03.000Z","updated_at":"2025-10-03T13:20:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"9532fd49-491e-4536-8177-6183f6fd8120","html_url":"https://github.com/miyako/4d-plugin-gmime","commit_stats":null,"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"purl":"pkg:github/miyako/4d-plugin-gmime","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miyako%2F4d-plugin-gmime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miyako%2F4d-plugin-gmime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miyako%2F4d-plugin-gmime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miyako%2F4d-plugin-gmime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miyako","download_url":"https://codeload.github.com/miyako/4d-plugin-gmime/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miyako%2F4d-plugin-gmime/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33617718,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["4d-plugin","mime"],"created_at":"2024-11-11T02:19:40.713Z","updated_at":"2026-05-28T16:31:17.043Z","avatar_url":"https://github.com/miyako.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"![version](https://img.shields.io/badge/version-19%2B-5682DF)\n![platform](https://img.shields.io/static/v1?label=platform\u0026message=mac-intel%20|%20mac-arm%20|%20win-64\u0026color=blue)\n[![license](https://img.shields.io/github/license/miyako/4d-plugin-gmime)](LICENSE)\n![downloads](https://img.shields.io/github/downloads/miyako/4d-plugin-gmime/total)\n\n# 4d-plugin-gmime\n\nParse MIME using the [GMIME](https://github.com/GNOME/gmime) library.\n\nswitched from libjson.7.6.1.lib to jsoncpp (`4.0.0`).\n\n**Notes on building static GLIB for MSVC**: \n\nlink gmime with static idn2 +``IDN2_STATIC``  \n\nlink glib with static pcre -``USE_SYSTEM_PCRE``  \n\nlink gio with static ffi +``FFI_BUILDING``\n\nforce static iconv in iconv.h and charset.h -``LIBICONV_DYNAMIC``\n\nuninstall Japanese version of Visual Studio ([zlib build fails with vcpkg](https://github.com/Microsoft/vcpkg/issues/1939))\n\nuse [VisualStudioUninstaller](https://github.com/Microsoft/VisualStudioUninstaller) and manually delete surviving registry keys\n\ncreate ``DllMain`` wrappers for glib, gio, gobject\n\n## Syntax\n\n```\nMIME PARSE MESSAGE (mime;json;data)\n```\n\nParameter|Type|Description\n------------|------------|----\nmime|BLOB|Raw MIME data (``.eml`` or ``.mbox``)\njson|TEXT|The parsed MIME content\ndata|ARRAY BLOB|Raw data (images, attachments) linked to the MIME content\n\n```\nmime:=MIME Create message (json;data)\n```\n\nParameter|Type|Description\n------------|------------|----\njson|TEXT|The parsed MIME content\ndata|ARRAY BLOB|Raw data (images, attachments) linked to the MIME content\nmime|BLOB|Raw MIME data\n\n### The parsed MIME content\n\n**Note**: The [JSON schema](https://github.com/miyako/4d-plugin-gmime/blob/master/MIME.4dbase/Resources/schema.json) is attached to the sample database.\n\nUse it like\n\n```\n$path:=Get 4D folder(Current resources folder)+\"schema.json\"\n$schema_json:=Document to text($path;\"utf-8\")\n$schema:=JSON Parse($schema_json)\n$errors:=JSON Validate($mime;$schema)\n```\n\n* Properties of the root ``message`` object\n\n``from`` : ``address`` array (optional)\n\n``cc`` : ``address`` array (optional)\n\n``to`` : ``address`` array (optional)\n\n``bcc`` : ``address`` array (optional)\n\n``sender`` : ``address`` array (optional)\n\n``reply_to`` : ``address`` array (optional)\n\n``all_recipients`` : ``address`` array (optional)\n\n``local_date`` : ``string`` (ISO)\n\n``utc_date`` : ``string`` (ISO)\n\n``local_time`` : ``number`` (milliseconds)\n\n``utc_time`` : ``number`` (milliseconds)\n\n``id`` : ``string``\n\n``headers`` : ``header`` array\n\n``subject`` : ``string``\n\n``body`` : ``part`` array\n\n``attachments`` : ``part`` array\n\nWhen creating MIME, you can also specify a ``subject_charset`` and ``mime_type``. Both are  ``string``.\n\nWhen creating MIME, the ``Date`` header is decided by ``utc_date``. If omitted, ``local_date`` is used instead.\n\nWhen creating MIME, ``subject``, ``id``, ``mime_type`` take precedence over header definition. \n\n---\n\n* Properties of an ``address`` object\n\n``name`` : ``string``\n\n``string`` : ``string``\n\n``encoded_string`` : ``string``\n\n``addr`` : ``string``\n\n``idn_addr`` : ``string``\n\nWhen creating a MIME, the only properties needed are ``name`` and ``addr``.\n\n---\n\n* Properties of a ``header`` object\n\n``name`` : ``string``\n\n``value`` : ``string``\n\n---\n\n* Parsing ``multipart/*`` messages\n\nParts that have a ``Content-Disposition`` of ``attachment``  are included in ``attachment``.\n\nOtherwise, they are included in ``body`` (``multipart-related``, ``multipart/alternative``).\n\n---\n\n* Creating ``multipart/*`` messages\n\n``body`` and ``attachments`` are processed separately \n\n* To create ``multipart/related``\n\npass all inline images in ``body``, not ``attachment``\n\n* To create ``multipart/mixed``\n\n pass all attachments in ``attachment``\n\n* To create ``multipart/alternative``\n\npass text and html in ``body``\n\n* To create ``multipart/alternative`` inside ``multipart/related``\n\npass text,  html and all inline images in ``body``\n\n---\n\n* Properties of a ``part`` object\n\n``mime_type`` : ``string``\n\n``media_type`` : ``string``\n\n``media_subtype`` : ``string``\n\n``file_name`` : ``string``\n\n``data`` : ``string`` for ``text/*``, ``number`` for other types \n\n``content_description`` : ``string`` (optional)\n\n``content_md5`` : ``string`` (optional)\n\n``content_location`` : ``string`` (optional)\n\n``content_encoding`` : ``string``\n\n``headers`` : ``header`` array\n\nWhen creating a MIME, make sure you specifiy the ``content_encoding`` in ``part``, not just as a header value.\n\nWhen creating a MIME, you can also specify a ``charset`` as ``string``.\n\nWhen creating MIME, ``mime_type``, ``content_id``, ``content_location``, ``content_description``, ``file_name``, ``content_md5`` take precedence over header values. ``content_encoding`` is always base64 for binary parts.\n\n## Example of parsing MIME\n\n```\n$path:=Get 4D folder(Current resources folder)+\"test.eml\"\n\nDOCUMENT TO BLOB($path;$eml)\n\nC_TEXT($mime_json)\nARRAY BLOB($mime_blobs;0)\nMIME PARSE MESSAGE ($eml;$mime_json;$mime_blobs)\n\n$mime:=JSON Parse($mime_json)\n\nARRAY OBJECT($body;0)\nOB GET ARRAY(OB Get($mime;\"message\";Is object);\"body\";$body)\n\n$subject:=ob get (OB Get($mime;\"message\";Is object);\"subject\";Is text)\n\n$plain:=OB Get($body{1};\"data\";Is text)\n$html:=OB Get($body{2};\"data\";Is text)\n```\n\n## Example of creating MIME\n\n```\n$path:=Get 4D folder(Current resources folder)+\"test.eml\"\n\nDOCUMENT TO BLOB($path;$eml)\n\nC_TEXT($mime_json)\nARRAY BLOB($mime_blobs;0)\nMIME PARSE MESSAGE ($eml;$mime_json;$mime_blobs)\n\n$preview:=JSON Parse($mime_json)\n\n//add an attachment\n\n$path:=Get 4D folder(Current resources folder)+\"wakanda-mascot-walking.png\"\nDOCUMENT TO BLOB($path;$image)\nAPPEND TO ARRAY($mime_blobs;$image)\n$message:=OB Get($preview;\"message\")\nARRAY OBJECT($body;0)\nOB GET ARRAY($message;\"body\";$body)\nC_OBJECT($b)\nOB SET($b;\\\n  \"file_name\";\"わかんだちゃん.png\";\\\n  \"content_description\";\"わかんだちゃん\";\\\n  \"content_location\";\"http://www.4d.com\";\\\n  \"content_md5\";Generate digest(\"わかんだちゃん\";MD5 digest);\\\n  \"mime_type\";\"image/png\";\\\n  \"data\";1)  //element number of this blob in $2\nARRAY OBJECT($headers;0)\nC_OBJECT($h)\nOB SET($h;\"name\";\"Content-Disposition\";\"value\";\"inline\")\nAPPEND TO ARRAY($headers;$h)\nOB SET ARRAY($b;\"headers\";$headers)\nAPPEND TO ARRAY($body;$b)\nOB SET ARRAY($message;\"body\";$body)\nOB SET($message;\"mime_type\";\"multipart/mixed\")\n\n$mime_json:=JSON Stringify($preview)\n\n$eml:=MIME Create message ($mime_json;$mime_blobs)\n\n$path:=System folder(Desktop)+\"1.eml\"\nBLOB TO DOCUMENT($path;$eml)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiyako%2F4d-plugin-gmime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiyako%2F4d-plugin-gmime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiyako%2F4d-plugin-gmime/lists"}