A few more minor cleanups of the attachment stuff.
This commit is contained in:
parent
b55266e821
commit
de1b160c2b
1 changed files with 6 additions and 5 deletions
|
|
@ -712,7 +712,6 @@ sub purge {
|
||||||
sub sendEmail {
|
sub sendEmail {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $var = shift;
|
my $var = shift;
|
||||||
my $attachments;
|
|
||||||
my $message = $self->processTemplate($var,$self->get("emailTemplateId"));
|
my $message = $self->processTemplate($var,$self->get("emailTemplateId"));
|
||||||
WebGUI::Macro::process($self->session,\$message);
|
WebGUI::Macro::process($self->session,\$message);
|
||||||
my ($to, $subject, $from, $bcc, $cc);
|
my ($to, $subject, $from, $bcc, $cc);
|
||||||
|
|
@ -729,12 +728,14 @@ sub sendEmail {
|
||||||
$subject = $row->{"field.value"};
|
$subject = $row->{"field.value"};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$attachments = $self->getAttachedFiles({returnType=>'attachments',entryId=>$var->{entryId}}) if $self->get("mailAttachments");
|
my @attachments = $self->get('mailAttachments')?
|
||||||
|
@{$self->getAttachedFiles({returnType=>'attachments',entryId=>$var->{entryId}})}
|
||||||
|
: ();
|
||||||
if ($to =~ /\@/) {
|
if ($to =~ /\@/) {
|
||||||
my $mail = WebGUI::Mail::Send->create($self->session,{to=>$to, subject=>$subject, cc=>$cc, from=>$from, bcc=>$bcc});
|
my $mail = WebGUI::Mail::Send->create($self->session,{to=>$to, subject=>$subject, cc=>$cc, from=>$from, bcc=>$bcc});
|
||||||
$mail->addHtml($message);
|
$mail->addHtml($message);
|
||||||
$mail->addFooter;
|
$mail->addFooter;
|
||||||
$mail->addAttachment($_) for (@{$attachments});
|
$mail->addAttachment($_) for (@attachments);
|
||||||
$mail->queue;
|
$mail->queue;
|
||||||
} else {
|
} else {
|
||||||
my ($userId) = $self->session->db->quickArray("select userId from users where username=".$self->session->db->quote($to));
|
my ($userId) = $self->session->db->quickArray("select userId from users where username=".$self->session->db->quote($to));
|
||||||
|
|
@ -756,14 +757,14 @@ sub sendEmail {
|
||||||
my $mail = WebGUI::Mail::Send->create($self->session,{to=>$cc, subject=>$subject, from=>$from});
|
my $mail = WebGUI::Mail::Send->create($self->session,{to=>$cc, subject=>$subject, from=>$from});
|
||||||
if ($cc) {
|
if ($cc) {
|
||||||
$mail->addHtml($message);
|
$mail->addHtml($message);
|
||||||
$mail->addAttachment($_) for (@{$attachments});
|
$mail->addAttachment($_) for (@attachments);
|
||||||
$mail->addFooter;
|
$mail->addFooter;
|
||||||
$mail->queue;
|
$mail->queue;
|
||||||
}
|
}
|
||||||
if ($bcc) {
|
if ($bcc) {
|
||||||
WebGUI::Mail::Send->create($self->session, {to=>$bcc, subject=>$subject, from=>$from});
|
WebGUI::Mail::Send->create($self->session, {to=>$bcc, subject=>$subject, from=>$from});
|
||||||
$mail->addHtml($message);
|
$mail->addHtml($message);
|
||||||
$mail->addAttachment($_) for (@{$attachments});
|
$mail->addAttachment($_) for (@attachments);
|
||||||
$mail->addFooter;
|
$mail->addFooter;
|
||||||
$mail->queue;
|
$mail->queue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue