-sub check_text_emails {
- my %args = %{ shift @_ };
- my @mail = @_;
-
- ok scalar @mail, "got some mail";
- for my $mail (@mail) {
- for my $type ('email', 'attachment') {
- next if $type eq 'attachment' && !$args{'Attachment'};
-
- my $content = $type eq 'email'
- ? "Some content"
- : "Attachment content";
-
- if ( $args{'Encrypt'} ) {
- unlike $mail, qr/$content/, "outgoing $type was encrypted";
- } else {
- like $mail, qr/$content/, "outgoing $type was not encrypted";
- }
-
- next unless $type eq 'email';
-
- if ( $args{'Sign'} && $args{'Encrypt'} ) {
- like $mail, qr/BEGIN PGP MESSAGE/, 'outgoing email was signed';
- } elsif ( $args{'Sign'} ) {
- like $mail, qr/SIGNATURE/, 'outgoing email was signed';
- } else {
- unlike $mail, qr/SIGNATURE/, 'outgoing email was not signed';
- }
- }
- }