NAME
App::MonM::Notifier::Channel::File - monotifier file channel
VERSION
Version 1.00
SYNOPSIS
use App::MonM::Notifier::Channel;
# Create channel object
my $channel = new App::MonM::Notifier::Channel;
# Send message via file channel
$channel->file(
{
id => 1,
to => "anonymous",
from => "sender",
subject => "Test message",
message => "Content of the message",
headers => {
"X-Foo" => "Extended eXtra value",
},
},
{
encoding => 'base64', # Default: 8bit
content_type => undef, # Default: text/plain
charset => undef, # Default: utf-8
dir => '.', # Default: your temp directory
filemask => "monotifier.msg", # Default: "[TO]_[ID]_[CRC16].[EXT]"
}) or warn( $channel->error );
# See error
print $channel->error unless $channel->status;
DESCRIPTION
This module provides "file" method that writes the content of the message to an external file
my $status = $channel->file( $data, $options );
The $data structure (hashref) describes body of message, the $options structure (hashref) describes parameters of the connection via external modules
DATA
It is a structure (hash), that can contain the following fields:
- id
-
Contains internal ID of the message. This ID is converted to an X-Id header
- to
-
Recipient address or name
- from
-
Sender address or name
- subject
-
Subject of the message
- message
-
Body of the message
- headers
-
Optional field. Contains eXtra headers (extension headers). For example:
headers => { "bcc" => "bcc\@example.com", "X-Mailer" => "My mailer", }
OPTIONS
It is a structure (hash), that can contain the following fields:
- dir
-
Defines path to save the message file
Default: your temp directory
- filemask
-
Defines special mask of the message's filename. The mask consists of directives like [NAME].
Supported directives:
- ID -- Internal ID of the message (see id field) - TO -- Normalized "to" field - CRC, CRC8, CRC16, CRC32 -- Check-codes of the message - EXT -- file extension (default: msg) - TIME -- Current time (in unix time format)
Default: "[TO]_[ID]_[CRC16].[EXT]"
About other options (base) see "OPTIONS" in App::MonM::Notifier::Channel
METHODS
- init
-
For internal use only!
Called from base class. Returns initialize structure
- handler
-
For internal use only!
Called from base class. Returns status of the operation
HISTORY
See CHANGES
file
DEPENDENCIES
TO DO
See TODO
file
BUGS
* none noted
SEE ALSO
App::MonM::Notifier, FileHandle, App::MonM::Notifier::Channel
AUTHOR
Sergey Lepenkov (Serz Minus) http://www.serzik.com <abalama@cpan.org>
COPYRIGHT
Copyright (C) 1998-2017 D&D Corporation. All Rights Reserved
LICENSE
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
See LICENSE
file