This perl subroutine uses the CPAN module Mail::Webmail::Gmail to iterate through a Gmail account searching for a particular string. If a match is found, the sender's name along with his/her email address, the subject, and the "blurb" is printed to standard out. Also, all messages found will be archived automatically within Gmail to clear the message from the inbox folder. The subroutine returns the number of messages found back to the calling environment.
Sample invocation: check_email(username, password);
By default, the subroutine will use encryption to connect to Gmail however, by setting encrypt_session to '0' will disable encryption.