Ignore:
Timestamp:
10/06/10 14:25:41 (14 years ago)
Author:
misc
Message:
  • show a error message when the mail server is down
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Epoll/View/Mail.pm

    r311 r377  
    3636    $ENV{MAILADDRESS} = $args->{From}; 
    3737    my $mailer = new Mail::Mailer 'smtp', Server => (Epoll->config->{smtp} || 'localhost'); 
    38     $mailer->open({ 
    39         (map { $_ => $args->{$_} } grep { $_ !~ /^(mail)$/ } keys %{ $args || {}}), 
    40         'Content-Type' => 'text/plain; charset=UTF-8; format=flowed', 
    41         'Content-Transfer-Encoding' => '8bit', 
    42         'X-Epoll-version' => $Epoll::DB::VERSION, 
    43     }); 
    44     print $mailer 
    45     Catalyst::View::TT::render($self, $c, $template, { %{ $args->{mail} || {} }, c => $c }); 
    46     $mailer->close; 
     38    eval {  
     39        $mailer->open({ 
     40            (map { $_ => $args->{$_} } grep { $_ !~ /^(mail)$/ } keys %{ $args || {}}), 
     41            'Content-Type' => 'text/plain; charset=UTF-8; format=flowed', 
     42            'Content-Transfer-Encoding' => '8bit', 
     43            'X-Epoll-version' => $Epoll::DB::VERSION, 
     44        }); 
     45        print $mailer 
     46        Catalyst::View::TT::render($self, $c, $template, { %{ $args->{mail} || {} }, c => $c }); 
     47        $mailer->close; 
     48    }; 
     49    if ($@) { 
     50        $c->stash->{mail_error} = $@; 
     51    }     
    4752} 
    4853 
Note: See TracChangeset for help on using the changeset viewer.