gmail
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 (2024). gmail (https://www.mathworks.com/matlabcentral/fileexchange/28919-gmail), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Data Import and Analysis > Data Import and Export > Web Access and Streaming > Web Services >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.