Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/supme/pg_email
Send email from postgresql
https://github.com/supme/pg_email
Last synced: 20 days ago
JSON representation
Send email from postgresql
- Host: GitHub
- URL: https://github.com/supme/pg_email
- Owner: Supme
- Created: 2019-03-14T09:24:22.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-14T10:01:56.000Z (almost 6 years ago)
- Last Synced: 2024-11-09T12:35:23.464Z (3 months ago)
- Language: Go
- Homepage:
- Size: 2.93 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pg_email
Send email from postgresqlAdd to postgresql.conf parameters:
```
email.serverhost = 'smtp.server.tld'
email.serverport = '465'
email.fromname = 'Postgres email sender'
email.fromemail = '[email protected]'
email.username = 'smtp_user'
email.password ='smtp_password'
```Get [compiled binary](https://github.com/Supme/pg_email/releases)
Copy files to postgres:
```
cp ./pg_email/pg_email.so /usr/lib/postgresql/11/lib/
cp ./pg_email/pg_email.control /usr/share/postgresql/11/extension/
cp ./pg_email/pg_email--0.1.sql /usr/share/postgresql/11/extension/
``````
CREATE EXTENSION pg_email;
```Use in SQL:
```
SELECT SendEmail (to_email, to_name, subject, text_html, text_plain)
```
return error or blank string then ok
Example:
```
SELECT sendemail('[email protected]', 'Alice', 'Email subject from postgresql', 'This HTML
Hello!!!
', 'This plain text. Hello!');
```