Loren on the Art of MATLAB

Turn ideas into MATLAB

Note

Loren on the Art of MATLAB has been archived and will not be updated.

My First Use of sendmail

Today I was working on a demo that someone else started. And then, wouldn't you know, I hit a snag. I decided that now was the time to learn to use sendmail so I could send my version of code right from my MATLAB session. It was so easy, I thought I'd show you how to do it.  

Contents

Set Preferences

I first tried using sendmail without reading all of the doc, just the input argument list. And I got an error telling me I had to use setpref to set MATLAB up to know about my internet presence. The first error message showed that I had to set up information about my email account.
       setpref('Internet','E_mail','xxx@company.com')
I tried sending the message again, and got prompted with a second error, so decided to read the reference page so I would bypass any other errors as well. Turned out, that wasn't necessary. I fixed my preferences again to set up information about the mail server.
       setpref('Internet','SMTP_Server','mail')

In Business!

Now I was in business and able to send the MATLAB code to my co-worker without leaving MATLAB.
       sendmail('yyy@company.com','demo files', ...
                'loren''s version','mydemo.m')

Do You Use sendmail?

I can imagine setting up a long simulation and sending my self email to let me know when it's done, especially if I am doing so during the evening or weekend. What tasks do you use sendmail for?

Published with MATLAB® 7.11


  • print

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.