Permalink
Browse files

refactor email code

  • Loading branch information...
lestrrat committed Apr 14, 2009
1 parent d8ea1bb commit 4d95c9270c906834c1f7b3832c42bd8d86ec8379
Showing with 16 additions and 34 deletions.
  1. +10 −13 core/lib/Pixis/Web/Controller/Signup.pm
  2. +6 −21 plugins/Pixis-Plugin-Event/lib/Pixis/Web/Controller/Event.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'));
}
@@ -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 {

0 comments on commit 4d95c92

Please sign in to comment.