# eric6.E5Network.E5GoogleMail

Module implementing a dialog to send bug reports.

### Global Attributes

None

### Classes

E5GoogleMail | Class implementing the logic to send emails via Google Mail.
E5GoogleMailAuthBrowser | Class implementing a simple web browser to perform the OAuth2 authentication process.

### Functions

GoogleMailHelp | Module function to get some help about how to enable the Google Mail OAuth2 service.

## E5GoogleMail

Class implementing the logic to send emails via Google Mail.

### Signals

sendResult(bool, str)
  emitted to indicate the transmission result and a result message

### Derived from

QObject

### Class Attributes

None

### Class Methods

None

### Methods

E5GoogleMail | Constructor
__credentialsFromSession | Private method to create a credentials object.
__doSendMessages | Private method to send all queued messages.
__loadToken | Private method to load a token from the token file.
__prepareMessage | Private method to prepare the message for sending.
__processAuthorization | Private slot to process the received authorization code.
__saveToken | Private method to save a token to the token file.
__startSession | Private method to start an authorized session and optionally start the authorization flow.
sendMessage | Public method to send a message via Google Mail.

### Static Methods

None

#### E5GoogleMail (Constructor)

E5GoogleMail(parent=None)

Constructor

parent (QObject)
  reference to the parent object

#### E5GoogleMail.__credentialsFromSession

__credentialsFromSession()

Private method to create a credentials object.

Returns:
  created credentials object

Return Type:
  google.oauth2.credentials.Credentials

#### E5GoogleMail.__doSendMessages

__doSendMessages()

Private method to send all queued messages.

#### E5GoogleMail.__loadToken

__loadToken()

Private method to load a token from the token file.

Returns:
  loaded token

Return Type:
  dict or None

#### E5GoogleMail.__prepareMessage

__prepareMessage(message)

Private method to prepare the message for sending.

message (email.mime.text.MIMEBase)
  message to be prepared

Returns:
  prepared message dictionary

Return Type:
  dict

#### E5GoogleMail.__processAuthorization

__processAuthorization(authCode)

Private slot to process the received authorization code.

authCode (str)
  received authorization code

#### E5GoogleMail.__saveToken

__saveToken(token)

Private method to save a token to the token file.

token (dict)
  token to be saved

#### E5GoogleMail.__startSession

__startSession()

Private method to start an authorized session and optionally start the authorization flow.

#### E5GoogleMail.sendMessage

sendMessage(message)

Public method to send a message via Google Mail.

message (email.mime.text.MIMEBase)
  email message to be sent

Up

## E5GoogleMailAuthBrowser

Class implementing a simple web browser to perform the OAuth2 authentication process.

### Signals

approvalCodeReceived(str)
  emitted to indicate the receipt of the approval code

### Derived from

QDialog

### Class Attributes

None

### Class Methods

None

### Methods

E5GoogleMailAuthBrowser | Constructor
__pageLoadFinished | Private slot handling the loadFinished signal.
__titleChanged | Private slot handling changes of the web page title.
load | Public method to start the authorization flow by loading the given URL.

### Static Methods

None

#### E5GoogleMailAuthBrowser (Constructor)

E5GoogleMailAuthBrowser(parent=None)

Constructor

parent (QWidget)
  reference to the parent widget

#### E5GoogleMailAuthBrowser.__pageLoadFinished

__pageLoadFinished()

Private slot handling the loadFinished signal.

#### E5GoogleMailAuthBrowser.__titleChanged

__titleChanged(title)

Private slot handling changes of the web page title.

title (str)
  web page title

#### E5GoogleMailAuthBrowser.load

load(url)

Public method to start the authorization flow by loading the given URL.

url (str or QUrl)
  URL to be laoded

Up

## GoogleMailHelp

GoogleMailHelp()

Module function to get some help about how to enable the Google Mail OAuth2 service.

Returns:
  help text

Return Type:
  str

Up