Filter löschen
Filter löschen

Encrypted file for account info in email script

2 Ansichten (letzte 30 Tage)
Alexander Ketzle
Alexander Ketzle am 20 Jan. 2022
Bearbeitet: Pravarthana P am 16 Feb. 2022
I have this script to send emails using MATLAB:
setpref('Internet','E_mail','EMAIL ADDRESS');
setpref('Internet','SMTP_Username','EMAIL USERNAME');
setpref('Internet','SMTP_Password','EMAIL PASSWORD');
props = java.lang.System.getProperties;
props.setProperty('mail.smtp.socketFactory.class', '');
sendmail('RECEIVER ADDRESS','I did it','I can also send attatchments');
and while the script itself (when filled in with the correct information) does function as intended, the inclusion of the email username and password in the .m file is obviously insecure. Does anyone know of a way of both encrypting a file with the information, and getting matlab to read it?
  1 Kommentar
Rik am 20 Jan. 2022
Anybody with access to the file containing your password and the code you wrote to decrypt it, will have access to the password. That is fundamental to the way this code will work.
If you actually want something secure, at the very least do NOT invent your own encryption and decryption method. Store the key in a third place.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Pravarthana P
Pravarthana P am 16 Feb. 2022
Bearbeitet: Pravarthana P am 16 Feb. 2022
Hi Alexander Ketzle, it can be understood that you are trying to protect the data that is present in your MATLAB source code. This is a known issue, for which you can find the possible workarounds as stated below:
1. You can replace your SMTP server username and password in your MATLAB preferences with blank values. You can do this by typing the following commands at the MATLAB command prompt:
2. You can always convert into Pcode that obfuscates the code although this doesn’t provide complete encryption of your code.
You may find the following link helpful:


Mehr zu Programming finden Sie in Help Center und File Exchange




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by