# eric6.UI.EmailDialog

Module implementing a dialog to send bug reports or feature requests.

### Global Attributes

None

### Classes

EmailDialog | Class implementing a dialog to send bug reports or feature requests.

### Functions

_encode_base64 | Function to encode the message's payload in Base64.

## EmailDialog

Class implementing a dialog to send bug reports or feature requests.

### Derived from

QDialog, Ui_EmailDialog

### Class Attributes

None

### Class Methods

None

### Methods

EmailDialog | Constructor
__createMultipartMail | Private method to create a multipart mail message.
__createSimpleMail | Private method to create a simple mail message.
__encodedHeader | Private method to create a correctly encoded mail header.
__encodedText | Private method to create a MIMEText message with correct encoding.
__sendmail | Private method to actually send the message.
__sendmailGoogle | Private method to actually send the message via Google Mail.
attachFile | Public method to add an attachment.
keyPressEvent | Protected method to handle the user pressing the escape key.
on_addButton_clicked | Private slot to handle the Add...
on_buttonBox_clicked | Private slot called by a button of the button box clicked.
on_buttonBox_rejected | Private slot to handle the rejected signal of the button box.
on_deleteButton_clicked | Private slot to handle the Delete button.
on_googleHelpButton_clicked | Private slot to show some help text "how to turn on the Gmail API".
on_message_textChanged | Private slot to handle the textChanged signal of the message edit.
on_sendButton_clicked | Private slot to send the email message.
on_subject_textChanged | Private slot to handle the textChanged signal of the subject edit.

### Static Methods

None

#### EmailDialog (Constructor)

EmailDialog(mode="bug", parent=None)

Constructor

mode
  mode of this dialog (string, "bug" or "feature")
parent
  parent widget of this dialog (QWidget)

#### EmailDialog.__createMultipartMail

__createMultipartMail()

Private method to create a multipart mail message.

Returns:
  prepared mail message

Return Type:
  email.mime.text.MIMEMultipart

#### EmailDialog.__createSimpleMail

__createSimpleMail()

Private method to create a simple mail message.

Returns:
  prepared mail message

Return Type:
  email.mime.text.MIMEText

#### EmailDialog.__encodedHeader

__encodedHeader(txt)

Private method to create a correctly encoded mail header.

txt
  header text to encode (string)

Returns:
  encoded header (email.header.Header)

#### EmailDialog.__encodedText

__encodedText(txt)

Private method to create a MIMEText message with correct encoding.

txt
  text to be put into the MIMEText object (string)

Returns:
  MIMEText object

#### EmailDialog.__sendmail

__sendmail(msg)

Private method to actually send the message.

msg
  the message to be sent (string)

Returns:
  flag indicating success (boolean)

#### EmailDialog.__sendmailGoogle

__sendmailGoogle(msg)

Private method to actually send the message via Google Mail.

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

Returns:
  flag indicating success

Return Type:
  bool

#### EmailDialog.attachFile

attachFile(fname, deleteFile)

Public method to add an attachment.

fname
  name of the file to be attached (string)
deleteFile
  flag indicating to delete the file after it has been sent (boolean)

#### EmailDialog.keyPressEvent

keyPressEvent(ev)

Protected method to handle the user pressing the escape key.

ev
  key event (QKeyEvent)

#### EmailDialog.on_addButton_clicked

on_addButton_clicked()

Private slot to handle the Add... button.

#### EmailDialog.on_buttonBox_clicked

on_buttonBox_clicked(button)

Private slot called by a button of the button box clicked.

button
  button that was clicked (QAbstractButton)

#### EmailDialog.on_buttonBox_rejected

on_buttonBox_rejected()

Private slot to handle the rejected signal of the button box.

#### EmailDialog.on_deleteButton_clicked

on_deleteButton_clicked()

Private slot to handle the Delete button.

#### EmailDialog.on_googleHelpButton_clicked

on_googleHelpButton_clicked()

Private slot to show some help text "how to turn on the Gmail API".

#### EmailDialog.on_message_textChanged

on_message_textChanged()

Private slot to handle the textChanged signal of the message edit.

#### EmailDialog.on_sendButton_clicked

on_sendButton_clicked()

Private slot to send the email message.

#### EmailDialog.on_subject_textChanged

on_subject_textChanged(txt)

Private slot to handle the textChanged signal of the subject edit.

txt
  changed text (string)

Up

## _encode_base64

_encode_base64(msg)

Function to encode the message's payload in Base64.

Note: It adds an appropriate Content-Transfer-Encoding header.

msg
  reference to the message object (email.Message)

Up