Apache-App-Mercury

 view release on metacpan or  search on metacpan

Mercury/Message/DBI.pm  view on Meta::CPAN

	       $self->{'subject'}, $self->{'body'},
	       ($is_memo || $self->{'nocopy'} || $after_first
		? 'deleted' : 'unread'),
	       ($self->{'transcode'} ? $self->{'transcode'} : ''),
	       ($self->{'transcode'} && !$after_first
		? ($self->{'display_trans'} ? $self->{'display_trans'} :'show')
		: 'hide'),
	       ($self->{'security'} ? $self->{'security'} : 'medium'));

	    $sth2->execute;
	    my $msgid;
	    $sth2->bind_columns(\$msgid);
	    $sth2->fetchrow_arrayref;
	    $sth2->finish;

	    $self->{'MessageIDs'}->{$msgid} = 1;
	    $after_first = 1;
	}

	$dbh->disconnect;
    };
    if ($@) {
	$self->log_error;
	return undef;
    }

Mercury/Message/DBI.pm  view on Meta::CPAN


	return undef unless $self->log_attachments;
    }

    return 1;
}

sub log_attachments {
    my ($self) = @_;

    my @msgids = keys %{$self->{'MessageIDs'}};
    my $placeholders = join(', ', map {'?'} @msgids);
    my $attachment_ids =
      join(' ', map { $_->{'AttachmentID'} } @{$self->{'Attachments'}});

    eval {
	my $dbh = DBI->connect(Apache::App::Mercury::Config::DBI_CONNECT_STR(),
			       Apache::App::Mercury::Config::DBI_LOGIN(),
			       Apache::App::Mercury::Config::DBI_PASS(),
			       {'RaiseError' => 1});
	my $sth = $dbh->prepare_cached
	  ("UPDATE ".Apache::App::Mercury::Config::DBI_SQL_MSG_TABLE()." SET attachments=?,timestamp=timestamp WHERE id IN($placeholders)");
	$sth->execute($attachment_ids, @msgids);
	$dbh->disconnect;
    };
    if ($@) {
	$self->log_error;
	return undef;
    }
    return 1;
}


Mercury/SMTP_Message.pm  view on Meta::CPAN

    $usermgr->{user} = $self->{'recipient'};

    my %autoforw =
      ( 'low' => $usermgr->auto_forward('low'),
	'medium' => $usermgr->auto_forward('medium'),
	'high' => $usermgr->auto_forward('high') );

    $self->{'address'} =
      ($usermgr->get_userinfo($self->{'recipient'}))[0]->{e_mail};

    $self->warn("->send_by_e_mail: attempting send of msgid='".$self->{'id'}."', user='".$self->{'recipient'}."', address='".$self->{'address'}."', msg_security='".$self->{'security'}."', autofwd='".$autoforw{$self->{'security'}}."'");

    # verify recipient has a valid e-mail address registered
    unless ($self->{'address'} =~ m/\@/) {
	$self->set_smtp_status;
	return 0;
    }

    # check recipient's auto-forward settings
    if ($autoforw{$self->{'security'}} eq 'message') {
	my $msg = $self->to_mime($self->{'address'});



( run in 1.063 second using v1.01-cache-2.11-cpan-ceb78f64989 )