# eric7.EricNetwork.EricGoogleMail

Module implementing a dialog to send bug reports.

### Global Attributes

None

### Classes

EricGoogleMail | Class implementing the logic to send emails via Google Mail.
EricGoogleMailAuthBrowser | 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.

## EricGoogleMail

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

EricGoogleMail | 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

#### EricGoogleMail (Constructor)

EricGoogleMail(parent=None)

Constructor

parent (QObject)
  reference to the parent object

#### EricGoogleMail.__credentialsFromSession

__credentialsFromSession()

Private method to create a credentials object.

Return:
  created credentials object

Return Type:
  google.oauth2.credentials.Credentials

#### EricGoogleMail.__doSendMessages

__doSendMessages()

Private method to send all queued messages.

#### EricGoogleMail.__loadToken

__loadToken()

Private method to load a token from the token file.

Return:
  loaded token

Return Type:
  dict or None

#### EricGoogleMail.__prepareMessage

__prepareMessage(message)

Private method to prepare the message for sending.

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

Return:
  prepared message dictionary

Return Type:
  dict

#### EricGoogleMail.__processAuthorization

__processAuthorization(authCode)

Private slot to process the received authorization code.

authCode (str)
  received authorization code

#### EricGoogleMail.__saveToken

__saveToken(token)

Private method to save a token to the token file.

token (dict)
  token to be saved

#### EricGoogleMail.__startSession

__startSession()

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

#### EricGoogleMail.sendMessage

sendMessage(message)

Public method to send a message via Google Mail.

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

Up

## EricGoogleMailAuthBrowser

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

EricGoogleMailAuthBrowser | 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

#### EricGoogleMailAuthBrowser (Constructor)

EricGoogleMailAuthBrowser(parent=None)

Constructor

parent (QWidget)
  reference to the parent widget

#### EricGoogleMailAuthBrowser.__pageLoadFinished

__pageLoadFinished()

Private slot handling the loadFinished signal.

#### EricGoogleMailAuthBrowser.__titleChanged

__titleChanged(title)

Private slot handling changes of the web page title.

title (str)
  web page title

#### EricGoogleMailAuthBrowser.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.

Return:
  help text

Return Type:
  str

Up