Sending awkward characters by email in Perl
Archive - Originally posted on "The Horse's Mouth" - 2009-06-12 16:41:21 - Graham EllisCarrying on from the email work I described in a recent article, I wrote an example today in Perl where I used the mailx program to send an email, piping to it in a system call via an echo.
For a one-liner, without special characters in the text, this is easy ... but to get echo to pass through all characters including the " delimiter and new lines took a bit more effort - but we did manage in the end with an absurdly easy looking piece of code - see here. There's an extended example, with the emial being routed to different addressed depending on its content, here.
Final - and off topic - example for today. Formatting in Perl with (s)printf. Did you know you can use "b" for binary? Example - and more formatted printing - here