Artifact abab880f7aa8d6a2f83337f1dbe1dbd65dca3224ebaaaab184e5de091591306f:
- Executable file
tools/email-sender.tcl
— part of check-in
[8c0ec30b]
at
2018-08-14 05:59:45
on branch trunk
— Changed all of the "sendmail -t" commands to "sendmail -ti" to make it ignore lines containing only a dot; we use EOF to signal "end of message," so we don't need the second signal. This is separate from the smtp.c fix in [51740ce45f]: that's only used when Fossil speaks directly to an SMTP server, where a leading dot is treated somewhat differently than the lone dot rule for sendmail(1)'s stdin.
This problem with leading dots was diagnosed by gumblex, /forumpost/4290f75ba1. (user: wyoung size: 818) [more...]
#!/usr/bin/tcl # # Monitor the database file named by the DBFILE variable # looking for email messages sent by Fossil. Forward each # to /usr/sbin/sendmail. # set POLLING_INTERVAL 10000 ;# milliseconds set DBFILE /home/www/fossil/emailqueue.db set PIPE "/usr/sbin/sendmail -ti" package require sqlite3 # puts "SQLite version [sqlite3 -version]" sqlite3 db $DBFILE db timeout 5000 catch {db eval {PRAGMA journal_mode=WAL}} db eval { CREATE TABLE IF NOT EXISTS email( emailid INTEGER PRIMARY KEY, msg TXT ); } while {1} { db transaction immediate { set n 0 db eval {SELECT msg FROM email} { set out [open |$PIPE w] puts -nonewline $out $msg flush $out close $out incr n } if {$n>0} { db eval {DELETE FROM email} } } after $POLLING_INTERVAL }