Tripletail

 view release on metacpan or  search on metacpan

lib/Tripletail/Sendmail/Esmtp.pm  view on Meta::CPAN

# -----------------------------------------------------------------------------
# Tripletail::Sendmail::Esmtp - Forcast esmtpを使用するメール送信
# -----------------------------------------------------------------------------
package Tripletail::Sendmail::Esmtp;
use base 'Tripletail::Sendmail';
use strict;
use warnings;
use Tripletail;

1;

sub _new {
	my $class = shift;
	my $group = shift;
	my $this = bless {} => $class;

	$this->{group} = $group;
	$this->{dbgroup} = $TL->INI->get($group => 'dbgroup');

	$this->{resend} = $TL->INI->get($group => 'resend', 1);
	$this->{resendlimit} = $TL->INI->get($group => 'resendlimit', '24 hours');

	$this;
}

sub send {
	my $this = shift;
	my $data = $this->_getoptSend(@_);

	my $DB = $TL->getDB($this->{dbgroup});

	foreach my $rcpt (@{$data->{rcpt}}) {
		$DB->execute(
			q{
				INSERT INTO mailsend
					(start, resend, mailfrom, rcptto, hourlimit, resendlimit, data)
				VALUES (NOW(), ?     , ?       , ?     , ''       , ?          , ?   )
			},
			$this->{resend} ? 'yes' : 'no',
			$data->{from},
			$rcpt,
			$TL->parsePeriod($this->{resendlimit}),
			$data->{data},
		);
	}

	$this;
}


__END__

=encoding utf-8

=for stopwords
	Forcast
	Ini
	YMIRLINK
	dbgroup
	esmtp
	ini
	resendlimit
	setTimeout

=head1 NAME

Tripletail::Sendmail::Esmtp - Forcast esmtp を使用するメール送信

=head1 DESCRIPTION

  !!注意!!
  このクラスを利用するにはEsmtpが必要です。
  Esmtpとは、ユミルリンク株式会社が販売している高速メール配信システムです。




( run in 1.230 second using v1.01-cache-2.11-cpan-d7f47b0818f )