Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: captbrando/pgMail
base: c69c6c14b6
...
head fork: captbrando/pgMail
compare: d5c2ffa376
  • 3 commits
  • 4 files changed
  • 0 commit comments
  • 2 contributors
Showing with 40 additions and 15 deletions.
  1. +6 −0 CHANGELOG
  2. +21 −8 README
  3. +1 −1  example.setup.sql
  4. +12 −6 pgMail.sql
View
6 CHANGELOG
@@ -1,5 +1,11 @@
Change Log.
+v1.2 - pgMail now properly sends UTF-8 encoded emails. Thanks to
+ Balazs Keresztury for the patch! (me)
+ - Fixed an issue whereby some servers would reject emails due to
+ "Improper use of SMTP command pipelining." Now resolved. (me)
+ - Updated to use the Apache 2.0 license. (me)
+
v1.1 - Added regular expression support to allow to/from fields to
either contain the name and email, or simply the email address. (me)
- Removed my mailserver from the stored proc. you must enter your
View
29 README
@@ -1,21 +1,32 @@
-pgMail v1.1 (05/01/2001)
+pgMail v1.2 (01/07/2012)
pgMail is maintained by Branden R. Williams <brw@brandolabs.com>
-and distributed under the GNU General Public License. pgMail is
-Copyright 2001 Branden R. Williams.
Homepage: http://www.brandolabs.com/pgmail
If you are interested in contributing to the project please email
the maintainer directly.
+------------------------------------------------------------------
+Copyright 2012 Branden R. Williams.
+
+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.
------------------------------------------------------------------
Welcome! This README will be short and sweet so you can get to
coding!
Essentially, pgMail is simply a stored function written in TCL
-which takes 4 arguments of type text (Who is it from, who is it
+which takes 4 arguments of type 'text' (Who is it from, who is it
to, subject, and body of message), contacts the email server via
-TCL sockets, and transmits your email.
+TCL sockets, and transmits your email (Now UTF-8 Compatible!).
Before you can use pgMail, you must install the TCL/u procedural
language. TCL/u is an UNRESTRICTED version of TCL that the
@@ -47,11 +58,11 @@ qualified domain name for your mailserver. i.e., mail.server.com.
Replace the text <ENTER YOUR DATABASESERVER HERE> with the fully
qualified domain name for your database server. i.e., db.server.com.
-*** END OF NOTICE ***
+*** NOW ON TO LESS DRAMATIC TEXT! ***
Once you have completed this step, use the psql interface to
add the pgMail function. Just copy the contents of the
-pgmail.sql file and paste them into your window. You may also
+pgmail.sql file and paste it into your window. You may also
load it directly from the command line by typing
# psql -e [database] < pgmail.sql
@@ -70,7 +81,9 @@ Testing your install.
There are some examples to try which have been included. You
MUST FIRST replace the string <YOUREMAIL> in the
-example.execute.sql script with your real email address.
+example.execute.sql script with your real email address, and
+install the plpgsql language just like you did the pltclu above.
+You can do that by entering a "createlang [YOUR DATABASE] plpgsql".
Once that is complete, execute the example.setup.sql. Then
execute the example.execute.sql script. You will see 2 emails
View
2  example.setup.sql
@@ -15,7 +15,7 @@ BEGIN
if customerRec.paystatus = ''y'' then
textMessage := ''Thank you for paying your bill. How sweet of you.
I love cake. Dont you?'';
- perform pgmail(''Order System<os@fart.com>'',customerRec.email,''You paid. How nice.'', textMessage);
+ perform pgmail(''Order System<os@store.com>'',customerRec.email,''You paid. How nice.'', textMessage);
end if;
return NEW;
END;' language 'plpgsql';
View
18 pgMail.sql
@@ -25,22 +25,28 @@ if {$fromemailaddress_start != -1} {
set fromemailaddress $mailfrom
}
fileevent $mySock writable [list svcHandler $mySock]
-fconfigure $mySock -buffering none
-puts $mySock "helo <ENTER YOUR DATABASESERVER HERE>"
+fconfigure $mySock -buffering line
+puts $mySock "HELO <ENTER YOUR DATABASESERVER HERE>"
gets $mySock name
-puts $mySock "mail from: $fromemailaddress"
+puts $mySock "MAIL FROM: $fromemailaddress"
gets $mySock name
-puts $mySock "rcpt to: $toemailaddress"
+puts $mySock "RCPT TO: $toemailaddress"
gets $mySock name
-puts $mySock "data"
+puts $mySock "DATA"
gets $mySock name
-puts $mySock "To: $mailto"
puts $mySock "From: $mailfrom"
+puts $mySock "To: $mailto"
puts $mySock "Subject: $mailsubject"
+puts $mySock "MIME-Version: 1.0"
+puts $mySock "Content-type: text/plain; charset=UTF-8"
+puts $mySock "Content-Transfer-Encoding: 8bit"
puts $mySock ""
puts $mySock "$mailmessage"
+puts $mySock ""
puts $mySock "."
gets $mySock name
+puts $mySock "QUIT"
+gets $mySock name
close $mySock
return 1'
language 'pltclu';

No commit comments for this range

Something went wrong with that request. Please try again.