Email::Simple

Simple email parsing module

Email::Simple

This is my attempt at porting Email::Simple from Perl 5 to Raku (mostly just because I can)

Example Usage

use Email::Simple;

my $eml = Email::Simple.new($raw-mail-text);
say $eml.body;

my $new = Email::Simple.create(header => [['To', '[email protected]'],
                                          ['From', '[email protected]'],
                                          ['Subject', 'test']],
                               body => 'This is a test.');
say ~$new;

Methods

  • new(Str $text, :$header-class = Email::Simple::Header)

  • new(Array $header, Str $body, :$header-class = Email::Simple::Header)

    Alias of .create with positional arguments.

  • create(Array :$header, Str :$body, :$header-class = Email::Simple::Header)

  • header($name, :$multi)

    Returns the email header with the name $name. If :$multi is not passed, then this will return the first header found. If :$multi is set, then this will return a list of all headers with the name $name (note the change from v1.0!)

  • header-set($name, *@lines)

    Sets the header $name. Adds one $name header for each additional argument passed.

  • header-names()

    Returns a list of header names in the email.

  • headers()

    Alias of header-names()

  • header-pairs()

    Returns the full header data for an email.

    $eml.header-pairs(); # --> [['Subject', 'test'], ['From', '[email protected]']]
  • body()

    Returns the mail body. Note that this module does not try to do any decoding, it just returns the body as-is.

  • body-set($text)

    Sets the mail body to $text. Note that this module does not try to properly encode the body.

  • as-string(), Str()

    Returns the full raw email, suitable for piping into sendmail.

  • crlf()

  • header-obj()

  • header-obj-set($obj)

AUTHOR

Andrew Egeler

Source can be located at: https://github.com/raku-community-modules/Email-Simple . Comments and Pull Requests are welcome.

COPYRIGHT AND LICENSE

Copyright 2012 - 2018 Andrew Egeler

Copyright 2019 - 2022 Raku Community

All files in this repository are licensed under the terms of Create Commons License; for details please see the LICENSE file

Email::Simple v2.1.1

Simple email parsing module

Authors

    License

    CC0-1.0

    Dependencies

    DateTime::Format

    Test Dependencies

    Provides

    • Email::Simple
    • Email::Simple::Header

    Documentation

    The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.