필터 지우기
필터 지우기

Multiple SMTP Servers for any type of email address?

조회 수: 1 (최근 30일)
Bryant
Bryant 2014년 7월 30일
댓글: Image Analyst 2015년 10월 28일
Hello I was wondering about a way to put in custom email addresses and smtp servers for various email service providers.
name_xls = num2str(filenamev1);
name_xls2 = [name_xls '.xls'];
xlswrite(name_xls, exceloutput, 'Sheet1','A1');
%Emails Excel sheet.
promptemail = menu( 'Email', 'Yes, email my results to my email!', 'No, I do not wish to email my results at this time.');
%Emails Excel sheet.
if promptemail==1
h = warndlg('Make sure your computer is connected to a secure Wifi connection! e.g: UCLA_WIFI, home network, etc. or disable your firewall!');
waitfor(h);
filepath = fullfile(pwd, name_xls2);
% Define a title for the dialog box
dialogtitle = 'Email Credentials';
% Define the labels for the individual entries
emailinfo = {'Email Address'};
% Create the dialog box with the inputdlg command
z = inputdlg(emailinfo, dialogtitle);
waitfor(z);
password = passcode;
setpref('Internet','SMTP_Server','smtp.gmail.com');
setpref('Internet','E_mail',z{1});
setpref('Internet','SMTP_Username',z{1});
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(z{1},['LFA Analysis for: ' num2str(filenamev1)] , 'Here are the results for your analysis!', filepath)
else
end
warndlg('Done!');

채택된 답변

Image Analyst
Image Analyst 2014년 8월 2일
Yes. Just detect which email service provider you are using with strfind() and take action (set custom email addresses and smtp servers) based on which providers you find.

추가 답변 (1개)

Shantanu
Shantanu 2015년 10월 28일
Hi, I am not able to run above code getting an error Error in Untitled12 (line 1) name_xls = num2str(filenamev1); Do I need to enter any value here
  댓글 수: 1
Image Analyst
Image Analyst 2015년 10월 28일
What is your error message? What value did you assign to filenamev1? Or did you not do that, in which case it will say something about filenamev1 not being defined. What is the complete error message (you forgot to post it!!!)?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Web Services에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by