MATLAB: For en engineering class i need to create a function that will send an email when under specific conditions, this is what ive written so far but it keep getting the error ‘to many outputs’

email functionMATLAB

function [m,s] = Door_Status(x)
setpref('Internet','SMTP_Server','smtp.gmail.com');
setpref('Internet','E_mail','myuser@gmail.com');
setpref('Internet','SMTP_Username','myuser');
setpref('Internet','SMTP_Password','mypassword');
props = java.lang.System.getProperties;
props.setProperty('mail.smtp.auth','true');
props.setProperty('mail.smtp.socketFactory.class', 'javax.net.ssl.SSLSocketFactory');
props.setProperty('mail.smtp.socketFactory.port','465');
if x==true
m = sendmail('recipiant@gmail.com','Door Status Update Code','true') ;
elseif x==false
s = sendmail('recipiant@gmail.com','Door Status Update Code','true') ;
end
end

Best Answer

sendmail() does not return a value.
Question: why are you sending the same message for x true as for x false?
Related Question