"my_message" is never get printed...
Nor in its current state would you expect it to, why have you put it in
? Change it to a string
$my_message = 'Hello world Look at my attachment';
$msg = MIME::Entity->build(From => 'firstname.lastname@example.org',
Type => "multipart/mixed",
To => 'email@example.com',
Subject => "Hello, ! ",
Data => $my_message);
There, that should've worked.
It gives some bogus cannot access/read-only file error messages...
Adding the actual error message might have helped but as a quick guess
I'd say check the documentation for the attach()
. That's probably the cause?