Skip to content

sshutdownow/pg_sendmail

Repository files navigation

pg_sendmail

pg_sendmail is PostgreSQL extension that implements mail function that rely on sendmail binary, say, ssmtp. There are some working examples that implement similar functionality in Perl or TCL. But perl add about 20Megs to every postgresql proccess and if it is the only one function in perl, you, perhaps, prefer my way.

Installation

  1. Download and unpack.
  2. Compile source code, to fullfill it for RedHat/CentOS postgresql-devel package is required (yum install postgresql-devel), for Debian/Ubuntu you should install postgresql-server-dev package (apt-get install postgresql-server-dev): make
  3. Install: sudo make install
  4. Register extension in PostgreSQL: CREATE EXTENSION pg_sendmail;

Usage:

To send mail wrapper function sendmail(text mailfrom, text rcpto, text subject, text msg_body) is very convinient to use, for example: SELECT sendmail('fromme@somedomain.com', 'tomygoodfriend@anotherdomain.com', 'test mail', E'mail message\nalso one line');

Copyright

Copyright (c) 2017-2025 Igor Popov

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Authors

Igor Popov (ipopovi |at| gmail |dot| com)

About

PostgreSQL extension that implements mail function in C that rely on sendmail binary

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors