Bugzilla – Attachment 3816 Details for
Bug 5251
Add support for using a gmail account as an SMTP server.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Signed off patch
0001-SIGNED-OFF-Enhancement-3.2-Resubmission-Adding-code-.patch (text/plain), 5.84 KB, created by
Magnus Enger
on 2011-04-07 15:55:24 UTC
(
hide
)
Description:
Signed off patch
Filename:
MIME Type:
Creator:
Magnus Enger
Created:
2011-04-07 15:55:24 UTC
Size:
5.84 KB
patch
obsolete
>From a48839a6723db61119454d86e15dd930bf3489ff Mon Sep 17 00:00:00 2001 >From: Chris Nighswonger <cnighswonger@foundations.edu> >Date: Fri, 19 Feb 2010 08:18:33 -0500 >Subject: [PATCH] [SIGNED-OFF] Enhancement: [3.2] (Resubmission) Adding code to support using gmail as an SMTP server > >This patch adds support for using a gmail account as an SMTP server. >It includes a basic HOWTO. > >Signed-off-by: Magnus Enger <magnus@enger.priv.no> >--- > C4/Letters.pm | 4 +- > misc/cronjobs/CONFIGURE.gmail | 65 ++++++++++++++++++++++++++++++++ > misc/cronjobs/process_message_queue.pl | 22 ++++++++--- > 3 files changed, 84 insertions(+), 7 deletions(-) > create mode 100644 misc/cronjobs/CONFIGURE.gmail > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 34e3686..269ec78 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -624,7 +624,7 @@ sub SendQueuedMessages (;$) { > # This is just begging for subclassing > next MESSAGE if ( lc($message->{'message_transport_type'}) eq 'rss' ); > if ( lc( $message->{'message_transport_type'} ) eq 'email' ) { >- _send_message_by_email( $message ); >+ _send_message_by_email( $message, $params->{'username'}, $params->{'password'}, $params->{'method'} ); > } > elsif ( lc( $message->{'message_transport_type'} ) eq 'sms' ) { > _send_message_by_sms( $message ); >@@ -789,6 +789,7 @@ ENDSQL > > sub _send_message_by_email ($;$$$) { > my $message = shift or return; >+ my ($username, $password, $method) = @_; > > my $to_address = $message->{to_address}; > unless ($to_address) { >@@ -824,6 +825,7 @@ sub _send_message_by_email ($;$$$) { > Message => $content, > 'content-type' => $message->{'content_type'} || 'text/plain; charset="UTF-8"', > ); >+ $sendmail_params{'Auth'} = {user => $username, pass => $password, method => $method} if $username; > if ( my $bcc = C4::Context->preference('OverdueNoticeBcc') ) { > $sendmail_params{ Bcc } = $bcc; > } >diff --git a/misc/cronjobs/CONFIGURE.gmail b/misc/cronjobs/CONFIGURE.gmail >new file mode 100644 >index 0000000..221c583 >--- /dev/null >+++ b/misc/cronjobs/CONFIGURE.gmail >@@ -0,0 +1,65 @@ >+============================= >+Installation Guide for Configuring a Koha Server to Use a Gmail Account as its SMTP Server >+============================= >+ >+Copyright (C) 2010 Foundations Bible College (http://www.foundations.edu) >+ >+Author: Chris Nighswonger (cnighswonger AT foundations DOT edu >+ >+Feedback/bug reports: Koha Developer's List: >+http://lists.koha.org/mailman/listinfo/koha-devel >+ >+This document last modified: 13 February 2010 >+ >+Configuration Instructions >+============================= >+ >+To use your gmail account as an SMTP server you will need to execute the following from a shell prompt. >+ >+(These steps are taken from http://jonspriggs.posterous.com/use-gmails-smtp-gateway-using-the-command-lin) >+ >+sudo apt-get install openssl xinetd >+ >+sudo tee /usr/bin/gmail-smtp <<EOF >/dev/null >+#!/bin/sh >+# Thanks to http://ubuntuforums.org/showthread.php?t=918335 for this install guide >+/usr/bin/openssl s_client -connect smtp.gmail.com:465 -quiet 2>/dev/null >+EOF >+sudo chmod +x /usr/bin/gmail-smtp >+ >+sudo tee /etc/xinetd.d/gmail-smtp <<EOF >/dev/null >+# default: on >+# description: Gmail SMTP wrapper for clients without SSL support >+# Thanks to http://ubuntuforums.org/showthread.php?t=918335 for this install guide >+service gmail-smtp >+{ >+ disable = no >+ bind = localhost >+ port = 10025 >+ socket_type = stream >+ protocol = tcp >+ wait = no >+ user = root >+ server = /usr/bin/gmail-smtp >+ type = unlisted >+} >+EOF >+sudo /etc/init.d/xinetd reload >+ >+Edit Mail/Sendmail.pm and set the port to 10025. (Note: This file will be located where ever your Perl libraries are.) >+ >+Script Setup Instructions >+============================= >+ >+After successfully executing the above steps, you will need to run the process_message_queue.pl script with the >+following syntax: >+ >+perl process_message_queue.pl -u librarian@foo.tld -p supersecret -m LOGIN >+ >+This, of course, assumes that you have all other scripts in place and functional to generate notices. >+ >+Misc Helpful Notes >+============================= >+ >+NOTE: In order to debug problems, you can set the debug level in Mail/Sendmail.pm to 11 which will give plenty of >+commentary to STDOUT. >diff --git a/misc/cronjobs/process_message_queue.pl b/misc/cronjobs/process_message_queue.pl >index 4ff29a4..c79fea8 100755 >--- a/misc/cronjobs/process_message_queue.pl >+++ b/misc/cronjobs/process_message_queue.pl >@@ -28,12 +28,19 @@ BEGIN { > use C4::Letters; > use Getopt::Long; > >+my $username = undef; >+my $password = undef; >+my $method = 'LOGIN'; > my $help = 0; > my $verbose = 0; > >-GetOptions( 'h' => \$help, >- 'v' => \$verbose, >- ); >+GetOptions( >+ 'u|username:s' => \$username, >+ 'p|password:s' => \$password, >+ 'm|method:s' => \$method, >+ 'h|help|?' => \$help, >+ 'v|verbose' => \$verbose, >+); > my $usage = << 'ENDUSAGE'; > > This script processes the message queue in the message_queue database >@@ -43,12 +50,15 @@ you run this regularly from cron, especially if you are using the > advance_notices.pl script. > > This script has the following parameters : >- -h help: this message >- -v verbose >+ -u --username: username of mail account >+ -p --password: password of mail account >+ -m --method: authentication method required by SMTP server (See perldoc Sendmail.pm for supported authentication types.) >+ -h --help: this message >+ -v --verbose: provides verbose output to STDOUT > > ENDUSAGE > > die $usage if $help; > >-C4::Letters::SendQueuedMessages( { verbose => $verbose } ); >+C4::Letters::SendQueuedMessages( { verbose => $verbose, username => $username, password => $password, method => $method } ); > >-- >1.7.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 5251
: 3816