Update draft/import/insert/sendemail (#959)

* Update draft/import/insert/sendemail

If possible, use same option names as already exist in my Gam for same commands.

Include charset with file.

* Code cleanup
This commit is contained in:
Ross Scroggs
2019-06-21 17:22:45 -07:00
committed by Jay Lee
parent 56371214b0
commit b812fef1c3
2 changed files with 12 additions and 8 deletions

View File

@@ -1286,7 +1286,10 @@ gam <UserTypeEntity> untrash messages query <QueryGmail> [doit] [max_to_untrash|
gam <UserTypeEntity> show gmailprofile [todrive]
gam <UserTypeEntity> sendemail [recipient <EmailAddress>] [subject <String>] [body <String>]
gam <UserTypeEntity> draftemail [recipient <EmailAddress>] [subject <String>] [(message <String>)|(file <FileName> [charset <Charset>])]
gam <UserTypeEntity> importemail [recipient <EmailAddress>] [subject <String> [(message <String>)|(file <FileName> [charset <Charset>])]]
gam <UserTypeEntity> insertemail [recipient <EmailAddress>] [subject <String>] [(message <String>)|(file <FileName> [charset <Charset>])]
gam <UserTypeEntity> sendemail [recipient <EmailAddress>] [subject <String>] [(message <String>)|(file <FileName> [charset <Charset>])]
gam <UserTypeEntity> create|add delegate|delegates <EmailAddress>
gam <UserTypeEntity> delegate|delegates to <EmailAddress>

View File

@@ -1074,7 +1074,7 @@ def callGAPI(service, function,
continue
systemErrorExit(4, str(e))
except (httplib2.ServerNotFoundError, RuntimeError) as e:
if (n != retries):
if n != retries:
service._http.connections = {}
waitOnFailure(n, retries, str(e))
continue
@@ -5351,12 +5351,13 @@ def sendOrDropEmail(users, method='send'):
i = 4
while i < len(sys.argv):
myarg = sys.argv[i].lower().replace('_', '')
if myarg == 'body':
if myarg == 'message':
body = sys.argv[i+1]
i += 2
elif myarg == 'bodyfile':
body = readFile(sys.argv[i+1])
i += 2
elif myarg == 'file':
filename = sys.argv[i+1]
i, encoding = getCharSet(i+2)
body = readFile(filename, encoding=encoding)
elif myarg == 'subject':
subject = sys.argv[i+1]
i += 2