[system] Repository:
ViewVC logotype

Revision 4679


Jump to revision: Previous Next
Author: sh002i
Date: Mon Nov 27 22:11:54 2006 UTC (12 years, 11 months ago)
Log Message:
added mail_answers_to3, which currently does not work, to eventually
replace mail_answers_to2, which also does not work.

I thought now would be a good time to commit this, so that others can
look at it if they like. The problem is that when RestrictedMailer is
used within a PG safe compartment, it hangs on opening the SMTP
connection and the problem times out after 60 seconds.

This mockup I made works perfectly however, and I can't see how the PG
safe compartment is different. Here it is:

my $mailer = new WeBWorK::Utils::RestrictedMailer(
        params => {
                from => 'sh002i@math.rochester.edu',
                smtp => 'mail.math.rochester.edu',
                headers => 'X-Remote-Host: 128.151.231.10',
                debug => "debug.txt",
                keepconnection => 1,
                subject => "generic subject",
                on_errors => 'die',
        },
        lock_by_default => 1,
        allow_change => [qw/fake_from to fake_to cc fake_cc bcc/],
        allowed_recipients => [qw/sh002i@math.rochester.edu sam@uofr.net/],
        fatal_errors => 1,
);
my $rmailer = new WeBWorK::Utils::RestrictedClosureClass($mailer,
        qw/Open SendEnc Close Cancel skipped_recipients error error_msg/);
my $safe = new Safe;
${$safe->varglob('the_date')} = `date`;
my $hole = new Safe::Hole {};
my $rmailer_wrapped = $hole->wrap($rmailer);
${$safe->varglob('TEST')}{rmailer} = $rmailer_wrapped;
my $result = $safe->reval(<<'EOF');
my $rmailer = $TEST{rmailer};
my $open_result = $rmailer->Open({
        to => 'sam@uofr.net',
        #subject => "this is only a test",
});
print "open_result=$open_result\n";
my $sendenc_result = $rmailer->SendEnc("Hello world, the time is " . $the_date);
print "sendenc_result=$sendenc_result\n";
$rmailer->Close;
EOF
die "reval threw an exception: $@" if $@;

Changed paths:

Path Details
Directorytrunk/pg/macros/PGanswermacros.pl modified , text changed

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9