Files
perl-Email-MIME-Kit/perl-Email-MIME-Kit.spec
2025-08-12 18:13:50 +02:00

150 lines
5.2 KiB
RPMSpec

#
# spec file for package perl-Email-MIME-Kit
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define cpan_name Email-MIME-Kit
Name: perl-Email-MIME-Kit
Version: 3.0.8
Release: 0
# 3.000008 -> normalize -> 3.0.8
%define cpan_version 3.000008
License: Artistic-1.0 OR GPL-1.0-or-later
Summary: Build messages from templates
URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/R/RJ/RJBS/%{cpan_name}-%{cpan_version}.tar.gz
Source1: cpanspec.yml
Source100: README.md
BuildArch: noarch
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(Email::MIME) >= 1.930
BuildRequires: perl(Email::MIME::Creator)
BuildRequires: perl(Email::MessageID) >= 1.400
BuildRequires: perl(ExtUtils::MakeMaker) >= 6.78
BuildRequires: perl(JSON) >= 2
BuildRequires: perl(Module::Runtime)
BuildRequires: perl(Moose) >= 0.65
BuildRequires: perl(Moose::Role)
BuildRequires: perl(Moose::Util::TypeConstraints)
BuildRequires: perl(String::RewritePrefix)
BuildRequires: perl(Test::Deep)
BuildRequires: perl(Test::More) >= 0.96
BuildRequires: perl(YAML::XS)
Requires: perl(Email::MIME) >= 1.930
Requires: perl(Email::MIME::Creator)
Requires: perl(Email::MessageID) >= 1.400
Requires: perl(JSON) >= 2
Requires: perl(Module::Runtime)
Requires: perl(Moose) >= 0.65
Requires: perl(Moose::Role)
Requires: perl(Moose::Util::TypeConstraints)
Requires: perl(String::RewritePrefix)
Requires: perl(YAML::XS)
Provides: perl(Email::MIME::Kit) = %{version}
Provides: perl(Email::MIME::Kit::Assembler::Standard) = %{version}
Provides: perl(Email::MIME::Kit::KitReader::Dir) = %{version}
Provides: perl(Email::MIME::Kit::ManifestReader::JSON) = %{version}
Provides: perl(Email::MIME::Kit::ManifestReader::YAML) = %{version}
Provides: perl(Email::MIME::Kit::Renderer::TestRenderer) = %{version}
Provides: perl(Email::MIME::Kit::Role::Assembler) = %{version}
Provides: perl(Email::MIME::Kit::Role::Component) = %{version}
Provides: perl(Email::MIME::Kit::Role::KitReader) = %{version}
Provides: perl(Email::MIME::Kit::Role::ManifestDesugarer) = %{version}
Provides: perl(Email::MIME::Kit::Role::ManifestReader) = %{version}
Provides: perl(Email::MIME::Kit::Role::Renderer) = %{version}
Provides: perl(Email::MIME::Kit::Role::Validator) = %{version}
%undefine __perllib_provides
%{perl_requires}
%description
Email::MIME::Kit is a templating system for email messages. Instead of
trying to be yet another templating system for chunks of text, it makes it
easy to build complete email messages.
It handles the construction of multipart messages, text and HTML
alternatives, attachments, interpart linking, string encoding, and
parameter validation.
Although nearly every part of Email::MIME::Kit is a replaceable component,
the stock configuration is probably enough for most use. A message kit will
be stored as a directory that might look like this:
sample.mkit/
manifest.json
body.txt
body.html
logo.jpg
The manifest file tells Email::MIME::Kit how to put it all together, and
might look something like this:
{
"renderer": "TT",
"header": [
{ "From": "WY Corp <noreplies@wy.example.com>" },
{ "Subject": "Welcome aboard, [% recruit.name %]!" }
],
"alternatives": [
{ "type": "text/plain", "path": "body.txt" },
{
"type": "text/html",
"path": "body.html",
"container_type": "multipart/related",
"attachments": [ { "type": "image/jpeg", "path": "logo.jpg" } ]
}
]
}
*Inline images* may be accessed with the function 'cid_for', for example to
include the above logo.jpg:
<img style="margin: 0 auto" src="cid:[% cid_for("logo.jpg") %]">
*Please note:* the assembly of HTML documents as multipart/related bodies
may be simplified with an alternate assembler in the future.
The above manifest would build a multipart alternative message. GUI mail
clients would see a rendered HTML document with the logo graphic visible
from the attachment. Text mail clients would see the plaintext.
Both the HTML and text parts would be rendered using the named renderer,
which here is Template-Toolkit.
The message would be assembled and returned as an Email::MIME object, just
as easily as suggested in the SYNOPSIS above.
%prep
%autosetup -n %{cpan_name}-%{cpan_version}
%build
perl Makefile.PL INSTALLDIRS=vendor
%make_build
%check
make test
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%files -f %{name}.files
%doc Changes README
%license LICENSE
%changelog