Main Content

이메일 보내기

MATLAB®에서 이메일을 보내려면 sendmail 함수를 사용하십시오. 파일을 이메일에 첨부할 수도 있으므로MATLAB에서 바로 파일을 메일로 보낼 수 있습니다. sendmail을 사용하려면 setpref 함수로 이메일 주소와 SMTP 서버 정보를 설정하십시오.

setpref 함수는 메일과 관련한 다음 두 가지 기본 설정을 정의합니다.

  • 이메일 주소: 이 기본 설정에 따라, 메시지에 표시되는 이메일 주소가 설정됩니다.

    setpref('Internet','E_mail','youraddress@yourserver.com');
    
  • SMTP 서버: 이 기본 설정에 따라, 보내는 SMTP 서버 주소가 설정됩니다. SMTP 서버는 POP(Post Office Protocol) 또는 IMAP(Internet Message Access Protocol)를 지원하는 거의 모든 이메일 서버일 수 있습니다.

    setpref('Internet','SMTP_Server','mail.server.network');
    

이메일 클라이언트 애플리케이션의 이메일 계정 설정에 있는 SMTP 서버 주소를 찾습니다. 또한 시스템 관리자에게 이 정보를 문의할 수도 있습니다.

MATLAB을 제대로 설정한 후에는 sendmail 함수를 사용할 수 있습니다. sendmail 함수를 사용하려면 적어도 두 개의 인수 즉, 받는 사람 이메일 주소와 이메일 제목이 필요합니다.

sendmail('recipient@someserver.com','Hello From MATLAB!');

문자형 벡터로 구성된 셀형 배열을 사용하여 이메일 주소를 여러 개 입력할 수 있습니다.

sendmail({'recipient@someserver.com','recipient2@someserver.com'}, ...
    'Hello From MATLAB!');

메시지 본문을 지정할 수 있습니다.

sendmail('recipient@someserver.com','Hello From MATLAB!', ...
    'Thanks for using sendmail.');

이메일에 파일을 첨부할 수 있습니다.

sendmail('recipient@someserver.com','Hello from MATLAB!', ...
    'Thanks for using sendmail.','C:\yourFileSystem\message.txt');

메시지가 없으면 파일을 첨부할 수 없습니다. 그러나 메시지는 비어 있을 수 있습니다.

이메일에 파일을 여러 개 첨부할 수 있습니다.

sendmail('recipient@someserver.com','Hello from MATLAB!', ...
    'Thanks for using sendmail.',{'C:\yourFileSystem\message.txt', ...
    'C:\yourFileSystem\message2.txt'});

참고 항목

|