Hi Dancers, During development, I've put a file with the username/email/password on the site (generally bad practice, I know), and have a button for sending a password reminder. When the user posts a form with an "email" field to the /reminder route (see below) it results in the following error, which is issued *after* the mail is sent out: The page 'http://localhost:3000/reminder' couldn't be loaded. Message Corrupt I would expect a redirect to '/reminder-has-been-sent' Do you have any suggestions? Kind regards, Joel -- post '/reminder' => sub { my $email = params->{email}; my $result = find_passwd($email); session user => undef; session failed_login => undef; if ($result) { send_out_mail($result->{email}, $result->{body}); # sent! redirect '/reminder-has-been-sent'; # no redirect } else { redirect '/email-not-found'; } }; There is a "before" clause. before sub { if (!session('user') and request->path_info !~ m{(login|bye|reminder|reminder-has-been-sent|email-not-found)$}) { # Pass the original path requested along to the handler: session requested_path => request->path_info; redirect('/login'); } elsif ( ! authorized( session('user'), request->path_info) and request->path_info ne '/forbidden'){ # Pass the original path requested along to the handler: session requested_path => request->path_info; redirect('/forbidden'); } }; sub find_passwd { my $user_or_email = shift; # we expect to be in Dancer app directory my @entries = read_file('pass'); my $body; my ($name, $email, $username, $password); map { chomp } @entries; foreach my $entry( @entries ){ ($name, $email, $username, $password) = split /\s*:\s*/, $entry; next if $user_or_email ne $username and $user_or_email ne $email; say "-->$name"; $body = mail_body($name, $username, $password); last } return({ email => $email, name => $name, password => $password, body => $body }) if $body; } sub mail_body { my ($name, $username, $password) = @_; my ($first) = $name =~ /(.+?)\s*\S*$/; #say $first; <<FORM; Dear $first, This automated mail contains your login credentials for http://example.com Your username is $username Your password is $password FORM } sub send_out_mail { my( $email, $body) = @_; my $sender = 'joelz@pobox.com'; Email::Stuffer->from($sender) ->to($email) ->subject("Reminder") ->text_body($body) ->send; } 1 -- Joel Roth