{"id":34681695,"url":"https://github.com/crossphoton/email-microservice","last_synced_at":"2026-04-26T14:31:11.074Z","repository":{"id":57643823,"uuid":"433401319","full_name":"crossphoton/email-microservice","owner":"crossphoton","description":"gRPC based emailing microservice","archived":false,"fork":false,"pushed_at":"2022-01-04T07:19:01.000Z","size":72,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-15T07:44:27.629Z","etag":null,"topics":["email-service","golang","grpc","microservice"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crossphoton.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":"CODEOWNERS ","security":null,"support":null}},"created_at":"2021-11-30T11:16:10.000Z","updated_at":"2023-03-04T10:23:09.000Z","dependencies_parsed_at":"2022-08-27T22:54:56.649Z","dependency_job_id":null,"html_url":"https://github.com/crossphoton/email-microservice","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/crossphoton/email-microservice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crossphoton%2Femail-microservice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crossphoton%2Femail-microservice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crossphoton%2Femail-microservice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crossphoton%2Femail-microservice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crossphoton","download_url":"https://codeload.github.com/crossphoton/email-microservice/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crossphoton%2Femail-microservice/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28008549,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-24T02:00:07.193Z","response_time":83,"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":["email-service","golang","grpc","microservice"],"created_at":"2025-12-24T21:12:09.186Z","updated_at":"2025-12-24T21:12:09.364Z","avatar_url":"https://github.com/crossphoton.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# email-microservice\ngRPC based emailing service for microservice based architecture.\n\n## Methods\n### **SendEmail**\n\nSend Standard emails with following parameters:\n- `Recipients` *[Recipients](#recipients)* - List of recipients\n- `Subject` *string* - Subject of the email\n- `Body` *string* - Email body\n- `ContentType` *string*: If `text/html` then HTML otherwise Plain text.\n- `Attachments` *[Attachment](#attachment)* - Attachments to be sent with email.\n- `Headers` *map(string  -\u003e string)* - Add headers.\n\n[Example](./examples/Std.go)\n### **SendRawEmail**\n\nSend Raw [RFC822](https://www.w3.org/Protocols/rfc822/) based emails:\n- `Recipients` *[string]* - List of recipients\n- `Body` *Bytes* - Email body\n\n[Example](./examples/Raw.go)\n\n### **SendEmailWithTemplate**\n\nSend Templated emails (templates should exist beforehand):\n- `Recipients` *[Recipients](#recipients)* - List of recipients\n- `Subject` *string* - Subject of the email\n- `TemplateName` *string* - Name of the template\n- `Attachments` *[Attachment](#attachment)* - Attachments to be sent with email.\n- `TemplateParams` *map(string  -\u003e string)* - Template data to be used in the template.\n- `Headers` *map(string  -\u003e string)* - Add headers.\n\n[Example](./examples/Template.go)\n\n## Usage\n\n### **As a service**\n\n### *Environment Variables*\n```\nSMTP_HOST:                  SMTP host\nSMTP_PORT:                  SMTP port\nSMTP_SENDER:                SMTP user\nSMTP_PASSWORD:              SMTP password\nPORT:                       Port to listen on\nPROMETHEUS_PORT:            Port to expose metrics on\n```\n\n### *Flags*\n```\n  -disableEmail\n        disable email sending\n  -help\n        show help\n  -port int\n        port to listen (default 5555)\n  -prometheusPort int\n        port to listen for prometheus (default 9090)\n  -smtpEmail string\n        SMTP email\n  -smtpHost string\n        SMTP host\n  -smtpPassword string\n```\n\n### *Templates*\nFor templates to be used in the email, they should be stored in the `./templates` directory relative to the binary. Naming scheme for files is `\u003ctemplate_name\u003e.html`, where `template_name` is the name of the template to be used by the client.\n\nTemplated are parsed using `html/template` package.\n- `{{.}}` - prints the value of the variable\n\n\u003e For docker, workdir in `/app`, hence, templates should be stored in `/app/templates` directory.\n\n### Docker\n```\ndocker run -d --name email-microservice --env-file app.env -p 5555:5555 crossphoton/email-microservice:v1.0.0\n```\n\n### Kubernetes\n\nUse the [deployment.yml](manifest/deployment.yml) file for the service deployment.\n\nThis requires a `smtp-secret` secret to be created which contains the following:\n- `SMTP_HOST` - SMTP host\n- `SMTP_PORT` - SMTP port\n- `SMTP_EMAIL` - SMTP email\n- `SMTP_PASSWORD` - SMTP password\n\nA template of this is also provided (See [secrets.yml](manifest/secrets.yml))\n\n### Locally\n1. Clone the repository\n2. After setting up the environment variables, run `go run main.go`\n\n\n### **As a client**\n\n\u003e **See examples in the [examples](./examples/) directory.**\n\nGenerate the client code using the proto file [email.proto](./email.proto)\n\n\u003e In examples directory run `./gen_proto.sh`\n\n# Additional Parts\n\n- **Prometheus** : Port `9090` is exposed for Prometheus metrics. Can be changed using [environment variable](#server-environment-variables).\n- **Logging** - [go.uber.org/zap](go.uber.org/zap) is used for logging.\n- **GRPC Middleware** - validation, prometheus, zap\n\n## TODO\n- Tracing\n- Graceful shutdown\n- Switch to Uber Go Style. [See the guide here](https://github.com/uber-go/guide/blob/master/style.md).\n- \n\n## License\n\nGNU General Public License v3.0\n\n\n## Types\n\n### Recipients\n`Recipients`:\n - `To` *[string]* - Recipient email address\n - `Cc` *[string]* - Carbon copy email address\n - `Bcc` *[string]* - Blind carbon copy email address\n\n\u003e `Name \u003caddress\u003e` formatting is supported.\n\n### Attachment\n`Attachment`:\n  - base64data *string* - Base64 encoded data of attachment.\n  - filename *string* - Name of attachment.\n\n\u003c!-- ## Dependencies\n\n- [simple-email-service](https://github.com/xhit/go-simple-mail)\n- [gRPC](https://google.golang.org/grpc)\n- [protobuf](https://google.golang.org/protobuf)\n- [prometheus](https://github.com/prometheus/client_golang)\n- [go-grpc-prometheus](https://github.com/grpc-ecosystem/go-grpc-prometheus) --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrossphoton%2Femail-microservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrossphoton%2Femail-microservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrossphoton%2Femail-microservice/lists"}