Skip to content

Commit

Permalink
Merge pull request #38 from sendgrid/gmime3.2
Browse files Browse the repository at this point in the history
TPOT-4847: Cleanup things for v1.0.0 release
  • Loading branch information
xdsxc authored Sep 12, 2022
2 parents 4a73a07 + 652a4cd commit 3501684
Show file tree
Hide file tree
Showing 104 changed files with 2,153 additions and 6,050 deletions.
3 changes: 0 additions & 3 deletions .envrc

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ src/
bin/ginkgo
go-gmime
data/
local/

.idea/
5 changes: 0 additions & 5 deletions .jenkins

This file was deleted.

3 changes: 0 additions & 3 deletions .jenkins-docker

This file was deleted.

12 changes: 0 additions & 12 deletions .travis.yml

This file was deleted.

1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ Kien Pham <[email protected]>
David McGuire <[email protected]>
Vyacheslav "Kane" Kim <[email protected]>
Alexander V. Nikolaev <[email protected]>
Dustin Guerrero <[email protected]>
4 changes: 0 additions & 4 deletions Berksfile

This file was deleted.

9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# valgrind only seems to work correctly with Go <= 1.17 (seeing an unknown instruction
# error on higher versions)
# admittedly, I haven't spent too much time trying to fix it but keep in mind
# if you're trying to increase the Go version
FROM golang:1.17-alpine3.16
RUN apk add gmime-dev build-base valgrind
COPY . /go/src/github.com/sendgrid/go-gmime
WORKDIR /go/src/github.com/sendgrid/go-gmime
RUN ["go", "build", "./cmd/gmime/main.go"]
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

113 changes: 7 additions & 106 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
[![Build Status](https://travis-ci.org/sendgrid/go-gmime.svg?branch=master)](https://travis-ci.org/sendgrid/go-gmime)

go-gmime
========

Expand All @@ -8,91 +6,27 @@ This project is a binding of the C-based GMime library for Golang.
Dependencies
---

- Go v. 1.2+
- GMime v. 2.6.19 or later, built with glib 2.38.0 or later.
- Go1.17
- GMime >= v3.0

Usage
---

Just add library with:

go get github.com/sendgrid/go-gmime

or using your favorite dependency manager (for example `godep` or `gom`)
go get github.com/sendgrid/go-gmime/v1/gmime

Setup for development
---

For OSX

# install required packages
brew install go
brew install gmime
bin/install_deps

On Ubuntu/Debian (trusty or jessie/sid, or later):

# install go and required packages
sudo apt-get install golang libgmime-2.6-dev

Earlier Ubuntu like `12.04 (precise)` require to backport glib2 (version
2.38.1 or later) and gmime-2.6 (2.6.19 or later)
Follow instructions in ``doc/packages.md`` for details.

``bin/install_dep`` also put symlink to package dir, so cloned dir accessable
for import by full-qualified name ``github.com/sendgrid/go-gmime/gmime``

Compose Message
---

```go

composer := NewComposer()
composer.AddFrom("Good Sender <[email protected]>")
composer.AddTo("[email protected]", "Good Customer")

// read data from a file:
fileHandler, _ := os.Open("data.txt")
defer fileHandler.Close()
reader := bufio.NewReader(fileHandler)

composer.AddHTML(reader)
print(composer.GetMessage())
```

Parse Message
---

```go

// Example on how to create a NewParse

fileHandler, _ := os.Open("fixtures/text_attachment.eml")
defer fileHandler.Close()
reader := bufio.NewReader(fileHandler)
parse := NewParse(reader)

fmt.Println(parse.From())
fmt.Println(parse.To())
fmt.Println(parse.Subject())
brew install go gmime

// Output:
// Dave McGuire <[email protected]>
// Team R&D <[email protected]>
// Distilled Content-Type headers (outbound & failed)

```

Documentation
Examples
---

Use [https://developer.gnome.org/gmime/stable/|GMime Reference Manual] as
documentation, this library have all classes/methods named very similiar with
original ``GMime`` classes.

All objects will be unreferenced (in terms of glib/gmime) when go-gmime
provided wrappers will be collected by go runtime.

See cmd/gmime/main.go for examples

Testing / Coverage
---
Expand All @@ -109,45 +43,12 @@ Testing / Coverage
# generate tests coverage
bin/cover

Vagrant VMs
---
We use Ubuntu to run Valgrind and CentOS to match SendGrid production

# setup the Vagrant vm box and access it:
vagrant up go-gmime-centos
vagrant up go-gmime-ubuntu

# access a VM box
vagrant ssh go-gmime-centos
vagrant ssh go-gmime-ubuntu

# run test on VM
bin/testvm

Benchmarks
---
Create and copy test emails to the data/ directory at the root of this project.

# benchmark using GMime binding
go run bench/gmime/test.go

# benchmark using native Go
go run bench/native/test.go

# benchmark using Perl
perl bench/perl/test.pl

# run integration GMime binding benchmark
bin/bench

Memory Check
---
We use Valgrind with **go-gmime-ubuntu** VM to check for memory leak. Run the command below inside the VM and check valgrind.log
We use Valgrind to check for memory leaks. The provided Dockerfile should setup a container ready to run Valgrind

bin/valgrind

(it require valgrind 3.9.x, 3.10.x is better, and gcc-go at least 4.9)

Contributing
---
# Don't forget to run gofmt before commiting
Expand Down
68 changes: 0 additions & 68 deletions Vagrantfile

This file was deleted.

88 changes: 0 additions & 88 deletions bench/Analyze.pm

This file was deleted.

Loading

0 comments on commit 3501684

Please sign in to comment.