## Loren on the Art of MATLABTurn ideas into MATLAB

Note

Loren on the Art of MATLAB has been retired 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.

### 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')

       sendmail('yyy@company.com','demo files', ...
'loren''s version','mydemo.m')