Confusing warning during compilation: Warning: MATLAB preference entry "SMTP_Username" has been removed.

14 次查看(过去 30 天)
回答: Derek Wolfe ,2021-10-1
I use sendmail in a compiled program that sends email via a generic gmail address. Username and password are set via:
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 个评论
Eric Delgado
Eric Delgado 2021-7-16
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?


回答(2 个)

Mohammad Sami
Mohammad Sami 2021-7-19
编辑:Mohammad Sami 2021-7-19
This is the correct behaviour for security reasons. Otherwise this information will be included from the previously set values in your Matlab environment if any. This would have happened regardless of whether you were using the mail function in your compiled program. These values would then have been exposed (visible in plain text) once you distribute your program to others.
Therefore you will need to use the setpref function in your code to set these values before you try to send the emails. You can also prompt the user for these values, then call the setpref function using the entered values.

Derek Wolfe
Derek Wolfe 2021-10-1
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)




Community Treasure Hunt

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

Start Hunting!

Translated by