Tripletail

 view release on metacpan or  search on metacpan

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

# -----------------------------------------------------------------------------
# Tripletail::Sendmail::Sendmail - Sendmailメール送信
# -----------------------------------------------------------------------------
package Tripletail::Sendmail::Sendmail;
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->{log} = $TL->INI->get($group => 'logging');
	$this->{commandline} = $TL->INI->get($group => 'commandline', '/usr/sbin/sendmail -t -i');

	$this;
}

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

	open my $sendmail, '|' . $this->{commandline}
	  or die __PACKAGE__."#send: failed to execute the sendmail command. [$this->{commandline}] (sendmailコマンドを使用できません)\n";
	
	my $senddata = $data->{data};
	$senddata =~ tr/\r//d;
	
	print $sendmail $senddata;

	$this;
}


__END__

=encoding utf-8

=for stopwords
	Ini
	YMIRLINK
	commandline

=head1 NAME

Tripletail::Sendmail::Sendmail - Sendmail メール送信

=head1 DESCRIPTION

sendmailコマンドを利用してメールを送信する。

=head2 METHODS

=over 4

=item new

=item send

  $smail->send(-data => $data)
  $smail->send(-data => $data)

宛先は C<-data> のヘッダから sendmail が抽出し、送信する。

=back


=head2 Ini パラメータ

=over 4



( run in 1.000 second using v1.01-cache-2.11-cpan-98e64b0badf )