Hi all,
I was wondering if there was a way for MATLAB to just attach a file automatically for sendmail that I made just by xlswrite instead of prompting the user with uigetfile for the attachment?
name_xls = input('What do you want to name the Excel file as?' , 's'); xlswrite(name_xls, exceloutput, '90CtT 45W','A1');%Emails Excel sheet.
h = warndlg('Make sure your computer is connected to a secure Wifi connection! e.g: UCLA_WIFI, home network, etc.');waitfor(h);filepath = uigetfile('.xls','Select which Excel sheet you wish to email to Gmail.',pwd);mail = input('Email Username (Gmail)?' , 's');password = input('Email Password?', 's');setpref('Internet','SMTP_Server','smtp.gmail.com');setpref('Internet','E_mail',mail);setpref('Internet','SMTP_Username',mail);setpref('Internet','SMTP_Password',password);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');sendmail(mail,'LFA Analysis','Here are the results for your analysis!', filepath)
Best Answer