Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

refactor email code

  • Loading branch information...
commit 4d95c9270c906834c1f7b3832c42bd8d86ec8379 1 parent d8ea1bb
@lestrrat lestrrat authored
View
23 core/lib/Pixis/Web/Controller/Signup.pm
@@ -137,19 +137,16 @@ sub send_activate :Local :Args(1) {
$c->stash->{ email } = $p->{email};
my $body = $c->view('TT')->render($c, 'signup/activation_email.tt');
- $body = Encode::encode('iso-2022-jp', $body);
- $c->stash->{email} = {
- to => $p->{email},
- from => 'no-reply@pixis',
- subject => "登録アクティベーションメール",
- body => $body,
- content_type => 'text/plain; charset=iso-2022-jp',
- headers => [
- Content_Encoding => '7bit'
- ]
- };
-
- $c->forward( $c->view('Email' ) );
+
+ $c->controller('Email')->send($c, {
+ header => {
+ To => $p->{email},
+ From => 'no-reply@pixis.local',
+ Subject => "登録アクティベーションメール",
+ },
+ body => $body
+ });
+
$c->res->redirect($c->uri_for('activate'));
}
View
27 plugins/Pixis-Plugin-Event/lib/Pixis/Web/Controller/Event.pm
@@ -7,14 +7,6 @@ use utf8;
use Encode();
use DateTime::Format::Strptime;
-sub COMPONENT {
- my ($self, $c, $config) = @_;
- $self = $self->NEXT::COMPONENT($c, $config);
-
- $self->config($config);
- $self;
-}
-
sub index :Index :Args(0) {
my ($self, $c) = @_;
@@ -193,21 +185,14 @@ sub send_confirmation : Private {
my ($self, $c) = @_;
my $body = $c->view('TT')->render($c, 'event/registration_confirmation.tt');
- $body = Encode::encode('iso-2022-jp', $body);
-
- $c->stash->{email} = {
- header => [
+ $c->controller('Email')->send($c, {
+ header => {
To => $c->user->email,
- Bcc => $self->config->{bcc},
From => 'no-reply@perlassociation.org',
- Subject => Encode::encode("MIME-Header-ISO_2022_JP", "イベント登録確認"),
- Content_Encoding => '7bit'
- ],
- body => $body,
- content_type => 'text/plain; charset=iso-2022-jp',
- };
-
- $c->forward( $c->view('Email') );
+ Subject => "イベント登録確認",
+ },
+ body => $body
+ });
}
sub done :Local {
Please sign in to comment.
Something went wrong with that request. Please try again.