Re: [Koha-devel] Test Email Page

2010-04-20 Thread nitesh rijal
I am about to test the script in my KOHA server. Please tell me where to
place the script prior running it. Is it the same place where other cronjobs
reside, or somewhere else.

Regards.

On Tue, Apr 20, 2010 at 10:37 AM, Rick Welykochy r...@praxis.com.au wrote:

 Chris Nighswonger wrote:

  I believe that there has been an effort over the development of Koha
 to separate the Koha administrative functions from the system
 administrative functions. Since mail setup falls squarely in the
 system administrative side of things, it might be better to write a
 test script which could be run from the cli.


 I agree with you Chris.

 Attached is such a script, to run from the command line.

 Anyone care to test it out? Works fine on my Koha systems.


 cheers
 rick



 --
 _
 Rick Welykochy || Praxis Services

 Politics is the business of getting power and privilege without
 possessing merit.
 -- PJ O'Rourke




-- 
Nitesh Rijal
BE IT
rijal...@gmail.com
http://niteshrijal.com.np
http://facebook.com/openrijal
http://twitter.com/openrijal
+9779841458173
___
Koha-devel mailing list
Koha-devel@lists.koha.org
http://lists.koha.org/mailman/listinfo/koha-devel

Re: [Koha-devel] Test Email Page

2010-04-20 Thread Rick Welykochy
nitesh rijal wrote:

 I am about to test the script in my KOHA server. Please tell me where to
 place the script prior running it. Is it the same place where other
 cronjobs reside, or somewhere else.

You can run the script from anywhere.

cheers
rickw



-- 
_
Rick Welykochy || Praxis Services

Politics is the business of getting power and privilege without
possessing merit.
  -- PJ O'Rourke
___
Koha-devel mailing list
Koha-devel@lists.koha.org
http://lists.koha.org/mailman/listinfo/koha-devel


Re: [Koha-devel] Test Email Page

2010-04-19 Thread Rick Welykochy

Chris Nighswonger wrote:


I believe that there has been an effort over the development of Koha
to separate the Koha administrative functions from the system
administrative functions. Since mail setup falls squarely in the
system administrative side of things, it might be better to write a
test script which could be run from the cli.


I agree with you Chris.

Attached is such a script, to run from the command line.

Anyone care to test it out? Works fine on my Koha systems.


cheers
rick



--
_
Rick Welykochy || Praxis Services

Politics is the business of getting power and privilege without
possessing merit.
 -- PJ O'Rourke
#!/usr/bin/env perl

# This script tests the Mail::Sendmail mailing service which is used internally
# by Koha.  The script sends a test email to one or more recipients and displays
# the result of the test.

# Copyright 2010 Rick Welykochy, NSW, Australia
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA  02111-1307 USA

use strict;
use warnings;
use Mail::Sendmail qw(sendmail %mailcfg);
use Getopt::Long;
use Sys::Hostname;

sub help
{
print ENDHERE;
$0: test sending email using the Koha method, which uses Mail::Sendmail.

use: $0 [ option ]... recipient...

 recipient ...one or more email recipients

options:
   -?  or --help  print this help message and exit
   -v  or --verbose   be verbose and also turn debugging on in 
Mail::Sendmail
   -n  or --nomaildo not send email, just show what would be done


Contents of Mail::Sendmail::mailcfg:

ENDHERE

for my $key (sort keys %mailcfg) {
my $value = $mailcfg{$key};
$value = @$value if ref($value)  ref($value) eq ARRAY;
printf %-25s %s\n, $key =, $value;
}
return 1;
}

sub dump_mail
{
my %params = @_;
my $message = '';
print Email dump:\n;
for my $key (keys %params) {
if ($key =~ /^message$|^body$|^text$/i) {
$message = $params{$key};
next;
}
printf %s: %s\n, $key, $params{$key};
}
print \n;
print $message\n if $message;
}

sub main
{
my $return  = 0;
my $help= 0;
my $verbose = 0;
my $nomail  = 0;

my %options = (
'help|?'= \$help,
'verbose|v' = sub { $mailcfg{debug} = 6; $verbose = 1; },
'nomail|n'  = \$nomail
);

if (!GetOptions(%options)) {
print STDERR $0: unrecognised command line argument. Try 
--help for help\n;
exit 1;
}

return help if $help;

my @recipients = @ARGV;
if (!...@recipients) {
print STDERR $0: missing email recipient. Try --help for 
help\n;
exit 1;
}

my $from= postmaster\@.hostname
my $to  = $recipients[0];
my $cc  = @recipients  1 ? join(, 
,@recipients[...@recipients-1]) : undef;
my $subject = Test email;
my $message = Hello. This is a test email, sent by the Koha script 
$0.\n;

my %mail = (
To  = $to,
From= $from,
Subject = $subject,
Message = $message,
'X-Mailer'  = Mail::Sendmail version 
$Mail::Sendmail::VERSION,
);
$mail{Cc} = $cc if $cc;

dump_mail(%mail) if $nomail || $verbose;

if ($nomail) {
print \nEmail not sent (--nomail)\n;
} else {
$return = sendmail(%mail);
print Email log: $Mail::Sendmail::log\n if 
$Mail::Sendmail::log  $verbose;
print Email error: $Mail::Sendmail::error\n if 
$Mail::Sendmail::error;
print Email sent to @recipients.\n if $return == 1;
}   

return $return;
}

exit main;


___
Koha-devel mailing list
Koha-devel@lists.koha.org
http://lists.koha.org/mailman/listinfo/koha-devel

Re: [Koha-devel] Test Email Page

2010-04-15 Thread Chris Nighswonger
2010/4/15 nitesh rijal rijal...@gmail.com:
 that would be an awesome Ideaits definitely needed.I have also faced
 a lot of such problems.
 I think we need to write in step by step process about what to do first and

I have submitted work which includes a step-by-step for setting up to
use gmail's smtp services:

http://lists.koha.org/pipermail/koha-patches/2010-February/005572.html

However, this does not address the setup of other mail services.
How-to's for others would be most welcome, no doubt.

 then what to successfully send overdue notifications and other email as
 well
 that would be a great thing for all if implemented.

For documentation on how to setup notices in the staff client, see:

http://koha-community.org/documentation/3-2-manual/?ch=x5083

as well as the section following that one.

For documentation on how to setup the cron jobs see the
misc/cronjobs/crontab.example file.


 How about an Email Test page in the Admin area? I'm willing to write such
 a page.

 Before doing that, I'd like any ideas developers have about such a thing.
 And I'd like some details on how email works in Koha from the horses'
 mouth.

I believe that there has been an effort over the development of Koha
to separate the Koha administrative functions from the system
administrative functions. Since mail setup falls squarely in the
system administrative side of things, it might be better to write a
test script which could be run from the cli.

Kind Regards,
Chris
___
Koha-devel mailing list
Koha-devel@lists.koha.org
http://lists.koha.org/mailman/listinfo/koha-devel


Re: [Koha-devel] Test Email Page

2010-04-14 Thread nitesh rijal
that would be an awesome Ideaits definitely needed.I have also faced
a lot of such problems.

I think we need to write in step by step process about what to do first and
then what to successfully send overdue notifications and other email as
well

that would be a great thing for all if implemented.

cheers.

On Thu, Apr 15, 2010 at 7:48 AM, Rick Welykochy r...@praxis.com.au wrote:

 Hi all,

 There is a thread on the Koha list, which repeatedly comes up, about
 email not working out of Koha.

 How about an Email Test page in the Admin area? I'm willing to write such
 a page.

 Before doing that, I'd like any ideas developers have about such a thing.
 And I'd like some details on how email works in Koha from the horses'
 mouth.


 cheers
 rickw



 --
 _
 Rick Welykochy || Praxis Services

 Politics is the business of getting power and privilege without
 possessing merit.
  -- PJ O'Rourke
 ___
 Koha-devel mailing list
 Koha-devel@lists.koha.org
 http://lists.koha.org/mailman/listinfo/koha-devel




-- 
Nitesh Rijal
BE IT
rijal...@gmail.com
http://niteshrijal.com.np
http://facebook.com/openrijal
http://twitter.com/openrijal
+9779841458173
___
Koha-devel mailing list
Koha-devel@lists.koha.org
http://lists.koha.org/mailman/listinfo/koha-devel