API Reference

Structures

GMime.Parser.EmailType
Email

Email structure with metadata and attachments.

Fields

  • from::Vector{String}: Vector of the email sender(s) addresses.
  • to::Vector{String}: Vector of the email recipient(s) addresses.
  • date::DateTime: The date and time the email was sent.
  • text_body::Vector{UInt8}: Binary data of the email's text body.
  • attachments::Vector{EmailAttachment}: Vector of the email attachments with metadata.
source
GMime.Parser.EmailAttachmentType
EmailAttachment

Fields

  • name::String: The attachment's file name.
  • encoding::String: The encoding type of the attachment.
  • mime_type::String: The attachment's MIME type.
  • body::Vector{UInt8}: Binary data of the attachment.
source

Parsing

GMime.Parser.parse_emailFunction
parse_email(data::Vector{UInt8}) -> Email
parse_email(data::String) -> Email

Parse a binary vector or string data into an Email.

Example

julia> email_string = """
       MIME-Version: 1.0
       Date: Tue, 5 Mar 1996 11:00:00 +0300
       Message-ID: <CAOU+8LMfxVaPMmigMQE2qTBLSbNdKQVps=Fi0S3X8LnfxT2xee@mail.email.com>
       Subject: Test Message
       From: Test User <username@example.com>
       To: Test User <username@example.com>
       Content-Type: multipart/alternative; boundary="000000000000dd23a50621ff39e8"
       
       --000000000000dd23a50621ff39e8
       Content-Type: text/plain; charset="UTF-8"
       
       Hello World!
       
       Best regards,
       Test User
       
       --000000000000dd23a50621ff39e8
       Content-Type: text/html; charset="UTF-8"
       
       <div dir="ltr">Hello World!<div><br></div><div>Best regards,</div><div>Test User</div></div>
       
       --000000000000dd23a50621ff39e8--
       """;

julia> email = parse_email(email_string)
📧 Email:
   📤 From: Test User <username@example.com>
   📥 To: Test User <username@example.com>
   🕒 Date: 1996-03-05T11:00:00
   📝 Text size: 39 bytes
   📨 No attachments.
source