Confusing warning during compilation: Warning: MATLAB preference entry "SMTP_Username" has been removed.
Show older comments
I use sendmail in a compiled program that sends email via a generic gmail address. Username and password are set via:
setpref('Internet','SMTP_Username',sender)
setpref('Internet','SMTP_Password',passwd)
When compiling with Compiler version: 8.1 (R2020b), I get the following warnings:
Warning: MATLAB preference entry "SMTP_Username" has been removed.
Warning: MATLAB preference entry "SMTP_Password" has been removed.
Still the code perfoms OK.
I don't really understand what this means, whether this is a feature that will be removed in future releases...
I could not find any information at mathworks or the internet in general. Any pointer is appreciated!
5 Comments
Walter Roberson
on 26 Apr 2021
Edited: Walter Roberson
on 18 Jul 2021
Clayton Gotberg
on 26 Apr 2021
My interpretation of the error is that when you run the compiler, MATLAB removes its memory of the listed preferences. Maybe try checking your preference list before and after you run the compiler to see if those values have changed.
setpref('Internet','SMTP_Username',sender)
setpref('Internet','SMTP_Password',passwd)
getpref('Internet')
%% Run compiler %%
getpref('Internet')
Walter Roberson
on 26 Apr 2021
Oh... I wonder...
It seems likely that for some preferences, you would want to take the preference setting of the user who is doing the compiling, and "hard code" those values into the executable, but that for some other preferences, you would want to not want to hard-code the values and would instead want to use the values set by the user at run-time . Perhaps that is what the message is talking about?
For example in this case each user of the executable might have to set their own Environment Variables for SMTP_Username and SMTP_Password, since that is something that is likely to be different for each user.
Clayton Gotberg
on 26 Apr 2021
I wonder if that is either to warn about or to repair this security issue? It seems that you're correct about MATLAB not wanting those preferences to be hard-coded!
Eric Delgado
on 16 Jul 2021
Hi @Ralf, it seems like a "default warning". I am still learning "Matlab Compiler" and made I simple app with no SMTP settings... but I receive this warning anyway.
Let me ask you something... :)
Do you know what is the best approach to deal with a big app that calls Python, for example? Should I build an app just to configure pyenv and my app PATHS, for example?
Accepted Answer
More Answers (1)
Derek Wolfe
on 1 Oct 2021
0 votes
I ran into the same issue. My compile script uses the following to clear Internet preferences before building:
% clear email preferences
if (isempty(getpref('Internet')) == false)
rmpref('Internet');
end
Categories
Find more on Web Services in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!