App-MonM

 view release on metacpan or  search on metacpan

lib/App/MonM/Channel.pm  view on Meta::CPAN

See also L<Email::MIME>

=item B<BasedOn>

    BasedOn SendMail

Sets name of the common channel (not user channel) for loading directives from it

=item B<Charset>

Sets the charset

Default: utf-8

See also L<Email::MIME>

=item B<ContentType>

Sets the content type

Default: text/plain

lib/App/MonM/Message.pm  view on Meta::CPAN

            to      => 'to@example.com',
            cc      => 'cc@example.com',
            bcc     => 'bcc@example.com',
            from    => 'from@example.com',
            subject => "Test message",
            body    => "Body of test message",
            headers => { # optional
                    "X-My-Header" => "test",
                },
            contenttype => "text/plain", # optional
            charset     => "utf-8", # optional
            encoding    => "8bit", # optional
            attachment  => [{ # See Email::MIME
                filename => "screenshot.png",
                type     => "image/png",
                encoding => "base64",
                disposition => "attachment",
                path     => "/tmp/screenshot.png",
            }],
        );

lib/App/MonM/Message.pm  view on Meta::CPAN


    if ($headers && is_hash($headers) && keys(%$headers)) {
        while (my ($k,$v) = each %$headers) {
            next unless defined $v;
            $hset{header_field_normalize($k)} = $v;
        }
    }

    # Attributes
    my $contenttype = $args{contenttype} // CONTENT_TYPE;
    my $charset = $args{charset} // CHARSET;
    my $encoding = $args{encoding} // ENCODING;

    # Body content
    my $body = $args{body} // '';

    # Multiparted message
    my @parts;
    my $main_part = Email::MIME->create(
        attributes => {
            content_type => $contenttype,
            charset      => $charset,
            encoding     => $encoding,
            disposition  => "inline", #disposition  => "attachment",
        },
        body_str => $body,
    );
    push @parts, $main_part;

    # Attachments
    my $attachments = node2anode($args{attachment});
    foreach my $inatt (@$attachments) {

lib/App/MonM/Message.pm  view on Meta::CPAN

    }

    # Create message (single or multipart)
    my $email = Email::MIME->create(
        header_str => [%hset],
        parts      => [ @parts ],
    );

    # Add attributes and body for single message
    #$email->content_type_set($contenttype);
    #$email->charset_set($charset);
    #$email->encoding_set($encoding);
    #$email->body_str_set($body);

    # Add X-Message-ID
    $self->{msgid} = $self->genId($to, $recipient, $subject);
    $email->header_str_set("X-Message-ID" => $self->{msgid});

    # Add X-Recipient
    $self->{recipient} = $recipient;
    $email->header_str_set("X-Recipient" => $recipient);

lib/App/MonM/QNotifier.pm  view on Meta::CPAN

        #print App::MonM::Util::explain($ch);
        my $message = App::MonM::Message->new(
            to          => lvalue($ch, "to"),
            cc          => lvalue($ch, "cc"),
            bcc         => lvalue($ch, "bcc"),
            from        => lvalue($ch, "from"),
            subject     => $args{subject} // '', # Message subject
            body        => $args{message} // '', # Message body
            headers     => hash($ch, "headers"),
            contenttype => lvalue($ch, "contenttype"), # optional
            charset     => lvalue($ch, "charset"), # optional
            encoding    => lvalue($ch, "encoding"), # optional
            attachment  => node($ch, "attachment"),
        );

        # Run before callback
        if (ref($before) eq 'CODE') {
            &$before($self, $message) or next;
        }

        # Send message



( run in 0.245 second using v1.01-cache-2.11-cpan-4d50c553e7e )