MCPcopy Create free account
hub / github.com/geekcomputers/Python / SendMessage

Function SendMessage

sendemail.py:37–48  ·  view source on GitHub ↗
(sender, to, subject, msgHtml, msgPlain, attachmentFile=None)

Source from the content-addressed store, hash-verified

35
36
37def SendMessage(sender, to, subject, msgHtml, msgPlain, attachmentFile=None):
38 credentials = get_credentials()
39 http = credentials.authorize(httplib2.Http())
40 service = discovery.build("gmail", "v1", http=http)
41 if attachmentFile:
42 message1 = createMessageWithAttachment(
43 sender, to, subject, msgHtml, msgPlain, attachmentFile
44 )
45 else:
46 message1 = CreateMessageHtml(sender, to, subject, msgHtml, msgPlain)
47 result = SendMessageInternal(service, "me", message1)
48 return result
49
50
51def SendMessageInternal(service, user_id, message):

Callers 1

mainFunction · 0.85

Calls 4

get_credentialsFunction · 0.85
CreateMessageHtmlFunction · 0.85
SendMessageInternalFunction · 0.85

Tested by

no test coverage detected