美文网首页MATLAB学习
2020-03-01 MATLAB App Designer——

2020-03-01 MATLAB App Designer——

作者: _何_其_ | 来源:发表于2020-03-01 01:24 被阅读0次
    
    function fun_mail2me(app,mailboxSet)
                % mailboxSet strcut结构
                % 包含变量:Sender/Server/Recipients/Password/Title/Content
                setpref('Internet','E_mail',mailboxSet.Sender);
                setpref('Internet','SMTP_Server',mailboxSet.Server);
                setpref('Internet','SMTP_Username',mailboxSet.Sender);
                setpref('Internet','SMTP_Password',mailboxSet.Password);
                props = java.lang.System.getProperties;
                props.setProperty('mail.smtp.auth','true');
                if ~isfield(mailboxSet,'Title');mailboxSet.Title = strcat(datestr(now,...
                        'yyyy-mm-dd HH:MM:SS'),32,'已完成通知');end
                % 循环发送信息  以“;”作为分隔符
                Recipients = split(mailboxSet.Recipients,';');
                for ii = 1 : length( Recipients )
                    if ~isempty( cell2mat(Recipients ( ii )))
                        try
                            sendmail(Recipients( ii ),mailboxSet.Title,mailboxSet.Content);
                            disp(strcat(datestr(now,'yyyy-mm-dd HH:MM:SS'),32,'已完成通知'));
                        catch
                            disp('ERROR!!! 通知出错') ;
                        end
                    end
                end
            end
    

    相关文章

      网友评论

        本文标题:2020-03-01 MATLAB App Designer——

        本文链接:https://www.haomeiwen.com/subject/zulohhtx.html