Mail::Field(3) User Contributed Perl Documentation Mail::Field(3)

Mail::Field - base-class for manipulation of mail header fields

```
 use Mail::Field;
    
 my $field = Mail::Field->new('Subject', 'some subject text');
 my $field = Mail::Field->new(Subject => 'some subject text');
 print $field->tag,": ",$field->stringify,"\n";
 my $field = Mail::Field->subject('some subject text');
```

"Mail::Field" creates and manipulates fields in MIME headers, collected within a Mail::Header object. Different field types have their own sub-class (extension), defining additional useful accessors to the field content.

People are invited to merge their implementation to special fields into MailTools, to maintain a consistent set of packages and documentation.

=c\_method new $tag \[, STRING | %options] Create an object in the class which defines the field specified by the $tag argument.

It is more clear to call either **stringify()** or **parse()** directly, because this method does not add additional processing.

All sub-classes should be called Mail::Field::*name* where *name* is derived from the tag using these rules.

- Consider a tag as being made up of elements separated by '-'
- Convert all characters to lowercase except the first in each element, which should be uppercase.
- *name* is then created from these elements by using the first N characters from each element.
- N is calculated by using the formula :-
  
  ```
      int((7 + #elements) / #elements)
      
  ```
- *name* is then limited to a maximum of 8 characters, keeping the first 8 characters.

For an example of this take a look at the definition of the \_header\_pkg\_name() subroutine in "Mail::Field"

# [POD ERRORS](#POD_ERRORS)

Hey! **The above document had some coding errors, which are explained below:**

[Around line 12:](#Around)

Unknown directive: =chapter

[Around line 16:](#Around~2)

Unknown directive: =chapter

[Around line 26:](#Around~3)

Unknown directive: =chapter

[Around line 28:](#Around~4)

Deleting unknown formatting code M&lt;&gt;

[Around line 36:](#Around~5)

Unknown directive: =chapter

[Around line 136:](#Around~6)

Unknown directive: =section

[Around line 144:](#Around~7)

Unknown directive: =error

[Around line 162:](#Around~8)

=cut found outside a pod block. Skipping to next block.

[Around line 207:](#Around~9)

=cut found outside a pod block. Skipping to next block.

[Around line 235:](#Around~10)

Unknown directive: =section

[Around line 237:](#Around~11)

Unknown directive: =method

[Around line 251:](#Around~12)

Unknown directive: =method

[Around line 263:](#Around~13)

Unknown directive: =section

[Around line 265:](#Around~14)

Unknown directive: =method

[Around line 275:](#Around~15)

=cut found outside a pod block. Skipping to next block.

[Around line 288:](#Around~16)

Unknown directive: =method

[Around line 298:](#Around~17)

Unknown directive: =section

[Around line 300:](#Around~18)

Unknown directive: =method

[Around line 304:](#Around~19)

Deleting unknown formatting code M&lt;&gt;

Deleting unknown formatting code M&lt;&gt;

[Around line 314:](#Around~20)

Unknown directive: =chapter

[Around line 316:](#Around~21)

Unknown directive: =section

2026-10-26 perl v5.44.0

---

Document: Mail::Field(3pm) from perl-mailtools 2.22-r5 (Chainguard OS)
Source: https://github.com/markov2/perl5-MailTools
