develooper Front page | perl.perl6.users | Postings from September 2017

Need MIME syntax help

From:
ToddAndMargo
Date:
September 29, 2017 04:00
Subject:
Need MIME syntax help
Message ID:
dbdbef36-530a-7ed5-9387-f615338ad5f4@zoho.com
Hi All,

This piece of code works:

<code>
  my $email = Email::MIME.create(
       header-str => [from => $from,
                      to => @to,
                      subject => $Subject ],
       parts => [
          Email::MIME.create(
             header => [ content-transfer-encoding => "quoted-printable" ],
             attributes => [ content-type => "text/plain", charset => 
"utf8" ],
             body-str => $Text ),

          Email::MIME.create(
             header => [ "Content-Transfer-Encoding" => "base64" ],
             # attributes => [ content-type => "image/x-portable-greymap",
             attributes => [ content-type => "application/zip; 
name=$FileName",
                             disposition => "attachment" ],
            body => $image )
        ]);
</code>


Problem.  If there is no attachment, I want to skip the

<code>
        Email::MIME.create(
             header => [ "Content-Transfer-Encoding" => "base64" ],
             # attributes => [ content-type => "image/x-portable-greymap",
             attributes => [ content-type => "application/zip; 
name=$FileName",
                             disposition => "attachment" ],
            body => $image )
        ]);
</code>

So I want to put the above into a test.

Question: How do I assign something additional to "$email"
AFTER I has called "my $email = Email::MIME.create"?


Many thanks,
-T



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About