Commit 3146feeb authored by Yadd's avatar Yadd
Browse files

Tidy (#595)

parent 2028c88c
...@@ -16,15 +16,21 @@ our $VERSION = '2.0.0'; ...@@ -16,15 +16,21 @@ our $VERSION = '2.0.0';
# PROPERTIES # PROPERTIES
has random => (is => 'rw', default => sub { has random => (
return String::Random->new; is => 'rw',
}); default => sub {
has charset => (is=>'rw',default => sub{return $_[0]->{conf}->{mailCharset} || 'utf-8'}); return String::Random->new;
}
);
has charset => (
is => 'rw',
default => sub { return $_[0]->{conf}->{mailCharset} || 'utf-8' }
);
# Generate a complex password based on a regular expression # Generate a complex password based on a regular expression
# @param regexp regular expression # @param regexp regular expression
sub gen_password { sub gen_password {
my($self,$regexp) = @_; my ( $self, $regexp ) = @_;
return $self->random->randregex($regexp); return $self->random->randregex($regexp);
} }
...@@ -53,7 +59,7 @@ sub send_mail { ...@@ -53,7 +59,7 @@ sub send_mail {
# Encode the subject # Encode the subject
$subject = encode_base64( $subject, '' ); $subject = encode_base64( $subject, '' );
$subject =~ s/\s//gs; $subject =~ s/\s//gs;
$subject = '=?'.$self->charset."?B?$subject?="; $subject = '=?' . $self->charset . "?B?$subject?=";
# Detect included images (cid) # Detect included images (cid)
my %cid = ( $body =~ m/"cid:([^:]+):([^"]+)"/g ); my %cid = ( $body =~ m/"cid:([^:]+):([^"]+)"/g );
...@@ -78,7 +84,7 @@ sub send_mail { ...@@ -78,7 +84,7 @@ sub send_mail {
# Attach HTML message # Attach HTML message
$message->attach( $message->attach(
Type => 'text/html; charset='.$self->charset, Type => 'text/html; charset=' . $self->charset,
Data => qq{$body}, Data => qq{$body},
); );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment