{"id":22104173,"url":"https://github.com/brianpursley/pg_smtp_client","last_synced_at":"2025-07-25T01:32:00.926Z","repository":{"id":245872978,"uuid":"811520358","full_name":"brianpursley/pg_smtp_client","owner":"brianpursley","description":"PostgreSQL extension to send email using SMTP","archived":false,"fork":false,"pushed_at":"2024-10-30T14:37:29.000Z","size":53,"stargazers_count":2,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-30T15:36:42.125Z","etag":null,"topics":["email","postgres","postgresql","postgresql-extension","rust","smtp"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/brianpursley.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2024-06-06T18:54:50.000Z","updated_at":"2024-10-30T14:27:17.000Z","dependencies_parsed_at":"2024-06-24T15:44:27.900Z","dependency_job_id":"846568fb-a623-4101-92ff-02abcb2c9d3a","html_url":"https://github.com/brianpursley/pg_smtp_client","commit_stats":null,"previous_names":["brianpursley/pg_smtp_client"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianpursley%2Fpg_smtp_client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianpursley%2Fpg_smtp_client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianpursley%2Fpg_smtp_client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianpursley%2Fpg_smtp_client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brianpursley","download_url":"https://codeload.github.com/brianpursley/pg_smtp_client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227500565,"owners_count":17781308,"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","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","postgres","postgresql","postgresql-extension","rust","smtp"],"created_at":"2024-12-01T06:28:54.645Z","updated_at":"2024-12-01T06:28:55.246Z","avatar_url":"https://github.com/brianpursley.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pg_smtp_client\n\n[![CI](https://github.com/brianpursley/pg_smtp_client/actions/workflows/ci.yml/badge.svg)](https://github.com/brianpursley/pg_smtp_client/actions/workflows/ci.yml)\n\nA Postgres extension to send emails using SMTP.\n\n## Installation\n\n### Install using Trunk\n\n```shell\ntrunk install pg_smtp_client\n```\n\n### Enabling the extension\n\nConnect to postgres and run the following command.\n\n```sql\nCREATE EXTENSION IF NOT EXISTS pg_smtp_client CASCADE;\n```\n\n## Usage\n\nUse the `smtp_client.send_email()` function to send an email.\n\n### Function Parameters\n\n| Parameter | Type | Description | System Configuration (Optional) |\n| --- | --- | --- | --- |\n| subject | text | The subject of the email | |\n| body | text | The body of the email | |\n| html | boolean | Whether the body is HTML (true) or plain text (false) | |\n| from_address | text | The from email address | `smtp_client.from_address` |\n| recipients | text[] | The email addresses of the recipients | |\n| ccs | text[] | The email addresses to CCs | |\n| bccs | text[] | The email addresses to BCCs | |\n| smtp_server | text | The SMTP server to use | `smtp_client.server` |\n| smtp_port | integer | The port of the SMTP server | `smtp_client.port` |\n| smtp_tls | boolean | Whether to use TLS | `smtp_client.tls` |\n| smtp_username | text | The username for the SMTP server | `smtp_client.username` |\n| smtp_password | text | The password for the SMTP server | `smtp_client.password` |\n\n### Default Configuration\n\nYou can configure the following system-wide default values for some of the parameters (as indiciated in the table above) like this:\n\n```\nALTER SYSTEM SET smtp_client.server TO 'smtp.example.com';\nALTER SYSTEM SET smtp_client.port TO 587;\nALTER SYSTEM SET smtp_client.tls TO true;\nALTER SYSTEM SET smtp_client.username TO 'MySmtpUsername';\nALTER SYSTEM SET smtp_client.password TO 'MySmtpPassword';\nALTER SYSTEM SET smtp_client.from_address TO 'from@example.com';\nSELECT pg_reload_conf();\n```\n\n### Usage Examples\n\nSend an email:\n```sql\nSELECT smtp_client.send_email('test subject', 'test body', false, 'from@example.com', array['to@example.com'], null, null, 'smtp.example.com', 587, true, 'username', 'password');\n```\n\nSend an email using configured default values:\n```sql\nSELECT smtp_client.send_email('test subject', 'test body', false, null, array['to@example.com']);\n```\n\nOr, using named arguments:\n```sql\nSELECT smtp_client.send_email('test subject', 'test body', recipients =\u003e array['to@example.com']);\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrianpursley%2Fpg_smtp_client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrianpursley%2Fpg_smtp_client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrianpursley%2Fpg_smtp_client/lists"}