Skip to content
This repository

Port of Perl 5's Email::Simple

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib Better way to support different header classes October 23, 2013
Octocat-spinner-32 t more tests; fix test plan March 29, 2013
Octocat-spinner-32 LICENSE Add CC0 license text March 29, 2013
Octocat-spinner-32 META.info
Octocat-spinner-32 README.md Attempt different doc format November 01, 2013
README.md

Email::Simple

This is my attempt at porting Email::Simple from perl 5 to perl 6 (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', 'mail@example.com'],
                                          ['From', 'me@example.com'],
                                          ['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)

    Returns a list of email headers with the name $name. If used in string context, will act like the first value of the list. (So you can call say $eml.header('Subject') and it will work correctly)

  • 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', 'me@example.com']]
    
  • 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)

License

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

Something went wrong with that request. Please try again.