Errors updating MATLAB Web App Server from r2020b to r2023b

13 views (last 30 days)
Dear MATLAB users,
i got some problems, when I'm trying to update the MATLAB Web App Server and some Web Apps from r2020b to r2023b.
1) sendmail function: Is this function not available on MATLAB Web App Server anymore, only local?
subject = ['Subject xyz];
mail.Body = sprintf('This is a test.');
sendmail(, subject, mail.Body, test1.pdf);
2023-11-20 18:01:46 Error using matlab.internal.lang.capability.Capability.require
2023-11-20 18:01:46 This functionality is not available on remote platforms.
2023-11-20 18:01:46 Error in sendmail (line 38)
2) WebSockets protocol? I didn't get this error in the older version.
WebSockets protocol was not established. This may cause performance degradation and occasional errors. Contact your System Administrator
Could you please help me?
Kind regards

Accepted Answer

Sanchari on 29 Nov 2023
Hello C.K.,
I understand that you are trying to fix the errors related to MATLAB Web App Server.
The error messages you provided indicate that the “sendmail” function is not available on remote platforms. When working in a remote environment, you may encounter restrictions on certain functions or capabilities due to security or system limitations. In this case, the “sendmail” function is being restricted by the capabilities of the remote platform.
To address this issue, consider the following steps:
  1. Enable less-secure app access feature for Google: To send an email through your Gmail account you must turn off the app security which greatly reduces the security of your Gmail account. One solution to this problem is creating a new Gmail account for the sole purpose of sending emails from this script. This link provides information on how to enable the less-secure app access, To turn off app security, sign into gmail and access this link:
  2. Disable AntiVirus: Turn off AntiVirus after implementing the above step. Also, disable the two step verification, if it shows. This should help to fix the error with WebSocket protocol.
  3. Example code: You can follow the example code below.
% User input
source = ''; %from address (gmail)
destination = ''; %to address (any mail service)
myEmailPassword = 'sifre123'; %the password to the 'from' account
subj = 'This is the subject line of the email'; % subject line
msg = 'This is the main body of the email.'; % main body of email.
%set up SMTP service for Gmail
% Gmail server.
props = java.lang.System.getProperties;
props.setProperty('mail.smtp.socketFactory.class', '');
% Send the email
% [Optional] Remove the preferences (for privacy reasons)
The “sendmail” function should be able to work after that.
Please refer the documentation for “sendmail” function to use with email servers that require authentication, like gmail, here:
Please refer the following ML Answers Learning for further clarification with issues regarding sendmail function:
  1. Sending E-mail error:
  2. Sending mail from gmail using sendmail() after authenticating less secure apps access on Google:
  3. Send Email using gmail failed:
  4. Valid base error problem in sending email for matlab:
  5. Using gmail after May 30, 2022:
Hope this information is helpful to you!
C. K.
C. K. on 29 Nov 2023
Edited: C. K. on 29 Nov 2023
Hi Sanchari,
thank you for this very detailed explanation. This really helps me a lot.
kind regards
Thomas Watson
Thomas Watson on 30 Nov 2023
Hi @Sanchari, is there a more technical explanation or list of troubleshooting steps concerning the WebSocket protocol issue that doesn't involve disabling AntiVirus software? Thank you

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!