Skip to content

GMime is a convenient wrapper around the GMime library for parsing email messages in Julia. It can extract sender, recipient, date, body text, attachments and other email information

License

Notifications You must be signed in to change notification settings

bhftbootcamp/GMime.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GMime.jl

Stable Dev Build Status Coverage Registry

GMime is a convenient wrapper around the GMime library for parsing email messages in Julia. It can extract sender, recipient, date, body text, attachments and other email information.

Installation

To install GMime, simply use the Julia package manager:

] add Gmime

Usage

Here's a small example of how to parse content from an email body:

using GMime
using EasyCurl

# Fetch the email data from an IMAP server
response = imap_request(
    "imaps://imap.gmail.com:993",
    get(ENV, "IMAP_USER", ""),
    get(ENV, "IMAP_PASSWORD", ""),
    mailbox = "INBOX",
    path = "MAILINDEX=993"
)

# Extract the raw email body
data = imap_body(response)

# Parse the email using GMime
julia> email = parse_email(data)
📧 Email:
   📤 From: Broker Support <support@broker.com>
   📥 To: Portfolio Manager <pm@hedgefund.com>
   🕒 Date: 2024-08-06T17:34:04
   📎 Attachments:
      1. 📎 Attachment:
   📄 Name: CashFlowReport_Q3_2024.pdf
   🛠️ Encoding: base64
   🏷 Mime type: application/pdf
   📏 Size: 18000 bytes

      2. 📎 Attachment:
   📄 Name: ClosedPositions_Summary_2024-08-06.csv
   🛠️ Encoding: base64
   🏷 Mime type: text/csv
   📏 Size: 250000 bytes

      3. 📎 Attachment:
   📄 Name: DailyTransaction_2024-08-06.csv
   🛠️ Encoding: base64
   🏷 Mime type: text/csv
   📏 Size: 12800 bytes

Useful Links

  1. Turn on the IMAP support at email provider cabinet. See this Gmail guide.
  2. Create an app-specific password for your email. See here for details.

Contributing

Contributions to GMime are welcome! If you encounter a bug, have a feature request, or would like to contribute code, please open an issue or a pull request on GitHub.

About

GMime is a convenient wrapper around the GMime library for parsing email messages in Julia. It can extract sender, recipient, date, body text, attachments and other email information

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages