use lib "$FindBin::Bin/modules";
use Constants qw(:shop);
use BSE::Session;
-use BSE::Mail;
use BSE::Template;
use BSE::Util::Tags;
use BSE::Request;
}
# in theory we have an email address at this point
-my $mailer = BSE::Mail->new(cfg=>$cfg);
-my $sendto = $cfg->entry('interest', 'notify', $SHOP_FROM);
+require BSE::ComposeMail;
+my $mailer = BSE::ComposeMail->new(cfg => $cfg);
+
+my $email = $cfg->entry('interest', 'notify',
+ $Constants::SHOP_FROM);
+$email ||= $cfg->entry('shop', 'from');
+unless ($email) {
+ print STDERR "No email configured for interest notify, set [interest].notify\n";
+ return;
+}
+#
my $product = $cgi->param('product');
defined($product) or $product = '';
my $product_id = $cgi->param('product_id');
email => sub { $useremail },
);
-my $content = BSE::Template->get_page('admin/interestemail', $cfg, \%acts);
-
my $subject = "User registered interest";
$subject .= " in product '$product'" if $product;
-if ($content =~ s/^subject:\s+([^\n])\r?\n\r?//i) {
- $subject = $1;
-}
-$mailer->send(to=>$sendto, from=>$SHOP_FROM, subject=>$subject,
- body => $content)
+$mailer->send(template => 'admin/interestemail',
+ acts => \%acts,
+ to=>$email,
+ from=>$email,
+ subject=>$subject)
or error_page('', "While sending email: ".$mailer->errstr);
BSE::Template->show_page('interest/confirm', $cfg, \%acts);
$email_user = $custom->send_user_email_to($user, $cfg);
};
}
- require 'BSE/Mail.pm';
-
- my $mail = BSE::Mail->new(cfg=>$cfg);
+ require BSE::ComposeMail;
+ my $mail = BSE::ComposeMail->new(cfg => $cfg);
my %mailacts;
%mailacts =
site => sub { $cfg->entryErr('site', 'url') },
emailuser => [ \&tag_hash_plain, $email_user ],
);
- my $body = BSE::Template->get_page('user/lostpwdemail', $cfg, \%mailacts);
my $from = $cfg->entry('confirmations', 'from') ||
$cfg->entry('basic', 'emailfrom') || $SHOP_FROM;
my $nopassword = $cfg->entryBool('site users', 'nopassword', 0);
my $subject = $cfg->entry('basic', 'lostpasswordsubject')
|| ($nopassword ? "Your options" : "Your password");
- $mail->send(from=>$from, to=>$email_user->{email}, subject=>$subject,
- body=>$body)
+ $mail->send(template => 'user/lostpwdemail',
+ acts => \%mailacts,
+ from=>$from,
+ to=>$email_user->{email},
+ subject=>$subject)
or return $self->req_show_lost_password($req,
$msgs->(lostmailerror=>
"Email error:".$mail->errstr,