Community discussions

MikroTik App
 
User avatar
eworm
Forum Guru
Forum Guru
Topic Author
Posts: 1071
Joined: Wed Oct 22, 2014 9:23 am
Location: Oberhausen, Germany
Contact:

MIME-Type setting for e-mail attachment

Wed May 11, 2016 9:43 pm

Hello everybody,

I have a script that updates WiFi PSK on a daily basis. It then downloads a matching QR-code with login credentials for mobile devices and sends information and QR-code (as PNG file attachment) via e-mail:
:local ssid "SSID";
:local newpsk "PSK";

/ interface wireless security-profile set wpa-pre-shared-key=$newpsk wpa2-pre-shared-key=$newpsk $profile;

:local host "www.eworm.de";
:local srcpath ("/cgi-bin/cqrlogo-wifi.cgi?scale=8&level=1&ssid=" . $ssid . &pass=" . $newpsk);

/ tool fetch mode=http address=$host host=$host src-path=$srcpath dst-path=qrcode-daily.png;

/ tool e-mail send to=$mailto subject=("[" . $name . "] daily PSK changed") body=("Daily PSK changed on " . $name . ".\n\nSSID: " . $ssid . "\nPSK: " . $newpsk . "\n\nhttp://" . $host . $srcpath) file=qrcode-daily.png;
However MIME-Type for the attachment is "application/octet-stream", which makes my mail client handle the attachment as a binary blob.

Any chance to add an option to set attachment MIME-Type? That would enable my mail client to display the e-mail body along with the attached image. Should look like this:
/ tool e-mail send to=$mailto subject=("[" . $name . "] daily PSK changed") body=("Daily PSK changed on " . $name . ".\n\nSSID: " . $ssid . "\nPSK: " . $newpsk . "\n\nhttp://" . $host . $srcpath) file=qrcode-daily.png file-mime-type="image/png";
But even current feature is really neat. 8)
Thanks a lot and have a nice day!

Who is online

Users browsing this forum: Bing [Bot], Frostbite1991, KOK, lubara and 176 guests