So I was working on a monitoring solution for our EC2 instances, this weekend. Of course, one of those features we had to put in was an email-notification facility. I built it out alright, but then came the email sending code.
I deciced to use Email::MIME and Email::Sender, since I don't think there are any Raku equivalents. I already had working code in Perl so I thought this would be a cinch for Inline::Perl5.
Then comes this bit:
my $email = Email::MIME.create(
'header_str' => [
From => 'me@sender.com',
To => 'you@the.recipient.biz',
Subject => "Drive Space Warning Triggered for 'i-deadbeef'"
],
'parts', $parts
);
Did that work?
Um. No.
Email::MIME comes back with 'no recipients'!
So I puttered around with Data::Dumper and found the problem: It's better to not use the Pair syntax, here.
This is what worked:
my $email = Email::MIME.create(
'header_str', [
'From', 'me@sender.com',
'To', 'you@the.recipient.biz',
'Subject'. "Drive Space Warning Triggered for 'i-deadbeef'"
],
'parts', $parts
);
Are there cleaner solutions?