image thumbnail


version (2.26 KB) by Naor Movshovitz
a reasonably secure wrapper for sendmail that configures, and deletes, settings for gmail servers


Updated 16 Oct 2010

View License

The MATLAB function sendmail will not work with a gmail account without some modification. The problem is that gmail server uses secure authentication and requires a user and password and some changes to the port and SSL settings. The doc page for sendmail (R2010b and later) explains how to do this. Two obvious problems are: (1) the preferences where username and password are saved are persistent between sessions and kept in an unsecure file on your hard drive - a bad idea. (2) the port and SSL setting are not persistent and need to be reset for each MATLAB session - annoying. GMAIL acts as a wrapper to sendmail that sets these values, sends an email, and then erases the user and password values. It is not ultra-secure but at least your password is not saved in a plain text file. Keep in mind though that your password string now exists in the command history! So an optional last argument allows you to delete the command history file after completion. (Note: I don't know how to delete just the last command without a long edit of the file.)

Call for comments: if you can think of another place where the password may be saved after running this function please let me know in the comments. Thanks.

Cite As

Naor Movshovitz (2021). gmail (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

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

Start Hunting!