summaryrefslogtreecommitdiff
path: root/LedgerSMB/Mailer.pm
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-04-12 20:46:20 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-04-12 20:46:20 +0000
commitdf073d6e09c0f87fb2e88cc215ace843a5851d4a (patch)
tree1c15ce909d3e0353b21bbd909e6720fd485a3a53 /LedgerSMB/Mailer.pm
parent65458125b8f3814fd6ef4d07b55ab69f62f5a528 (diff)
Formatting with Perltidy
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@1068 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB/Mailer.pm')
-rwxr-xr-xLedgerSMB/Mailer.pm152
1 files changed, 76 insertions, 76 deletions
diff --git a/LedgerSMB/Mailer.pm b/LedgerSMB/Mailer.pm
index 05a711bd..eb1d4a9b 100755
--- a/LedgerSMB/Mailer.pm
+++ b/LedgerSMB/Mailer.pm
@@ -1,5 +1,5 @@
#=====================================================================
-# LedgerSMB
+# LedgerSMB
# Small Medium Business Accounting software
# http://www.ledgersmb.org/
#
@@ -19,7 +19,7 @@
# Author: DWS Systems Inc.
# Web: http://www.sql-ledger.org
#
-# Contributors:
+# Contributors:
#
# Original Author and copyright holder:
# Dieter Simader dsmimader@sql-ledger.com
@@ -40,85 +40,85 @@ use MIME::Base64;
use LedgerSMB::Sysconfig;
sub new {
- my ($type) = @_;
- my $self = {};
+ my ($type) = @_;
+ my $self = {};
- bless $self, $type;
+ bless $self, $type;
}
-
sub send {
- my ($self) = @_;
-
- my $domain = $self->{from};
- $domain =~ s/(.*?\@|>)//g;
- my $msgid = "$boundary\@$domain";
-
-
- $self->{contenttype} = "text/plain" unless $self->{contenttype};
-
- my %h;
- for (qw(from to cc bcc)) {
- $self->{$_} =~ s/\&lt;/</g;
- $self->{$_} =~ s/\&gt;/>/g;
- $self->{$_} =~ s/(\/|\\|\$)//g;
- $h{$_} = $self->{$_};
- }
-
- $h{subject} =
- ($self->{subject} =~ /([\x00-\x1F]|[\x7B-\xFFFF])/)
- ? "Subject: =?$self->{charset}?B?".
- MIME::Base64::encode($self->{subject},"")."?="
- : "Subject: $self->{subject}";
-
- my $msg = MIME::Lite->new(
- 'From' => $self->{from},
- 'To' => $self->{to},
- 'Cc' => $self->{cc},
- 'Bcc' => $self->{bcc},
- 'Subject' => $self->{subject},
- 'Type' => 'TEXT',
- 'Data' => $self->{message},
- );
- $msg->add('Disposition-Notification-To' => $self->{from})
- if $self->{notify};
- $msg->replace('X-Mailer' => "LedgerSMB $self->{version}");
-
- if (@{ $self->{attachments} }) {
- foreach my $attachment (@{ $self->{attachments} }) {
-
- my $application =
- ($attachment =~
- /(^\w+$)|\.(html|text|txt|sql)$/)
- ? "text"
- : "application";
-
- my $filename = $attachment;
- # strip path
- $filename =~ s/(.*\/|$self->{fileid})//g;
- $msg->attach(
- 'Type' => "$application/$self->{format}",
- 'Path' => $attachment,
- 'Filename' => $filename,
- 'Disposition' => 'attachment',
- );
- }
-
- }
-
- if (${LedgerSMB::Sysconfig::smtphost}) {
- $msg->send('smtp', ${LedgerSMB::Sysconfig::smtphost},
- Timeout => ${LedgerSMB::Sysconfig::smtptimeout}) ||
- return $!;
- } else {
- $msg->send('sendmail', ${LedgerSMB::Sysconfig::sendmail}) ||
- return $!;
- }
-
- return "";
-
-}
+ my ($self) = @_;
+
+ my $domain = $self->{from};
+ $domain =~ s/(.*?\@|>)//g;
+ my $msgid = "$boundary\@$domain";
+
+ $self->{contenttype} = "text/plain" unless $self->{contenttype};
+
+ my %h;
+ for (qw(from to cc bcc)) {
+ $self->{$_} =~ s/\&lt;/</g;
+ $self->{$_} =~ s/\&gt;/>/g;
+ $self->{$_} =~ s/(\/|\\|\$)//g;
+ $h{$_} = $self->{$_};
+ }
+
+ $h{subject} =
+ ( $self->{subject} =~ /([\x00-\x1F]|[\x7B-\xFFFF])/ )
+ ? "Subject: =?$self->{charset}?B?"
+ . MIME::Base64::encode( $self->{subject}, "" ) . "?="
+ : "Subject: $self->{subject}";
+
+ my $msg = MIME::Lite->new(
+ 'From' => $self->{from},
+ 'To' => $self->{to},
+ 'Cc' => $self->{cc},
+ 'Bcc' => $self->{bcc},
+ 'Subject' => $self->{subject},
+ 'Type' => 'TEXT',
+ 'Data' => $self->{message},
+ );
+ $msg->add( 'Disposition-Notification-To' => $self->{from} )
+ if $self->{notify};
+ $msg->replace( 'X-Mailer' => "LedgerSMB $self->{version}" );
+
+ if ( @{ $self->{attachments} } ) {
+ foreach my $attachment ( @{ $self->{attachments} } ) {
+
+ my $application =
+ ( $attachment =~ /(^\w+$)|\.(html|text|txt|sql)$/ )
+ ? "text"
+ : "application";
+
+ my $filename = $attachment;
+
+ # strip path
+ $filename =~ s/(.*\/|$self->{fileid})//g;
+ $msg->attach(
+ 'Type' => "$application/$self->{format}",
+ 'Path' => $attachment,
+ 'Filename' => $filename,
+ 'Disposition' => 'attachment',
+ );
+ }
+
+ }
+
+ if ( ${LedgerSMB::Sysconfig::smtphost} ) {
+ $msg->send(
+ 'smtp',
+ ${LedgerSMB::Sysconfig::smtphost},
+ Timeout => ${LedgerSMB::Sysconfig::smtptimeout}
+ ) || return $!;
+ }
+ else {
+ $msg->send( 'sendmail', ${LedgerSMB::Sysconfig::sendmail} )
+ || return $!;
+ }
+
+ return "";
+}
1;