You are here

class MimeMailPHPMailer in PHPMailer 5

Same name and namespace in other branches
  1. 6 includes/mimemail.inc \MimeMailPHPMailer

Hierarchy

Expanded class hierarchy of MimeMailPHPMailer

File

includes/mimemail.inc, line 5

View source
class MimeMailPHPMailer extends PHPMailer {

  /**
   * Constructor.
   */
  function MimeMailPHPMailer() {
    $this
      ->IsSMTP();

    // Assemble host name(s).
    $protocol = variable_get('smtp_protocol', '');
    $this->Host = $protocol . variable_get('smtp_host', '');
    if ($backup = variable_get('smtp_hostbackup', '')) {
      $this->Host .= ';' . $protocol . $backup;
    }
    $this->Port = variable_get('smtp_port', '25');

    // Use SMTP authentication if both username and password are given.
    $this->Username = variable_get('smtp_username', '');
    $this->Password = variable_get('smtp_password', '');
    $this->SMTPAuth = $this->Username != '' && $this->Password != '';

    // Set default From name.
    $from_name = variable_get('smtp_fromname', '');
    if ($from_name == '') {

      // Fall back on site name.
      $from_name = variable_get('site_name', 'Drupal');
    }
    $this->FromName = $from_name;
    $this->SMTPKeepAlive = variable_get('smtp_keepalive', 0);
    $this->SMTPDebug = variable_get('smtp_debug', 0);
    $this->CharSet = variable_get('smtp_charset', 'utf-8');

    // Adjust path to SMTP class.
    $this->PluginDir = drupal_get_path('module', 'phpmailer') . '/phpmailer/';
  }

  /**
   * Sets the language for all class error messages.
   */
  function SetLanguage($lang_type, $lang_path = null) {
    $PHPMAILER_LANG = array();
    $PHPMAILER_LANG["provide_address"] = t('You must provide at least one recipient email address.');
    $PHPMAILER_LANG["mailer_not_supported"] = t(' mailer is not supported.');
    $PHPMAILER_LANG["execute"] = t('Could not execute: ');
    $PHPMAILER_LANG["instantiate"] = t('Could not instantiate mail function.');
    $PHPMAILER_LANG["authenticate"] = t('SMTP Error: Could not authenticate.');
    $PHPMAILER_LANG["from_failed"] = t('The following From address failed: ');
    $PHPMAILER_LANG["recipients_failed"] = t('SMTP Error: The following recipients failed: ');
    $PHPMAILER_LANG["data_not_accepted"] = t('SMTP Error: Data not accepted.');
    $PHPMAILER_LANG["connect_host"] = t('SMTP Error: Could not connect to SMTP host.');
    $PHPMAILER_LANG["file_access"] = t('Could not access file: ');
    $PHPMAILER_LANG["file_open"] = t('File Error: Could not open file: ');
    $PHPMAILER_LANG["encoding"] = t('Unknown encoding: ');
    $this->language = $PHPMAILER_LANG;
    return true;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MimeMailPHPMailer::MimeMailPHPMailer function Constructor.
MimeMailPHPMailer::SetLanguage function Sets the language for all class error messages. Overrides PHPMailer::SetLanguage
PHPMailer::$AltBody property Sets the text-only body of the message. This automatically sets the email to multipart/alternative. This body can be read by mail clients that do not have HTML email capability such as mutt. Clients that can read HTML will view the normal Body.
PHPMailer::$attachment property
PHPMailer::$bcc property
PHPMailer::$Body property Sets the Body of the message. This can be either an HTML or text body. If HTML then run IsHTML(true).
PHPMailer::$boundary property
PHPMailer::$cc property
PHPMailer::$CharSet property Sets the CharSet of the message.
PHPMailer::$ConfirmReadingTo property Sets the email address that a reading confirmation will be sent.
PHPMailer::$ContentType property Sets the Content-type of the message.
PHPMailer::$CustomHeader property
PHPMailer::$Encoding property Sets the Encoding of the message. Options for this are "8bit", "7bit", "binary", "base64", and "quoted-printable".
PHPMailer::$ErrorInfo property Holds the most recent mailer error message.
PHPMailer::$error_count property
PHPMailer::$From property Sets the From email address for the message.
PHPMailer::$FromName property Sets the From name of the message.
PHPMailer::$Helo property Sets the SMTP HELO of the message (Default is $Hostname).
PHPMailer::$Host property Sets the SMTP hosts. All hosts must be separated by a semicolon. You can also specify a different port for each host by using this format: [hostname:port] (e.g. "smtp1.example.com:25;smtp2.example.com"). Hosts will be tried in order.
PHPMailer::$Hostname property Sets the hostname to use in Message-Id and Received headers and as default HELO string. If empty, the value returned by SERVER_NAME is used or 'localhost.localdomain'.
PHPMailer::$language property
PHPMailer::$LE property
PHPMailer::$Mailer property Method to send mail: ("mail", "sendmail", or "smtp").
PHPMailer::$message_type property
PHPMailer::$Password property Sets SMTP password.
PHPMailer::$PluginDir property Path to PHPMailer plugins. This is now only useful if the SMTP class is in a different directory than the PHP include path.
PHPMailer::$Port property Sets the default SMTP server port.
PHPMailer::$Priority property Email priority (1 = High, 3 = Normal, 5 = low).
PHPMailer::$Protocol property
PHPMailer::$ReplyTo property
PHPMailer::$Sender property Sets the Sender email (Return-Path) of the message. If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
PHPMailer::$Sendmail property Sets the path of the sendmail program.
PHPMailer::$smtp property
PHPMailer::$SMTPAuth property Sets SMTP authentication. Utilizes the Username and Password variables.
PHPMailer::$SMTPDebug property Sets SMTP class debugging on or off.
PHPMailer::$SMTPKeepAlive property Prevents the SMTP connection from being closed after each mail sending. If this is set to true then to close the connection requires an explicit call to SmtpClose().
PHPMailer::$Subject property Sets the Subject of the message.
PHPMailer::$Timeout property Sets the SMTP server timeout in seconds. This function will not work with the win32 version.
PHPMailer::$to property
PHPMailer::$Username property Sets SMTP username.
PHPMailer::$Version property Holds PHPMailer version.
PHPMailer::$WordWrap property Sets word wrapping on the body of the message to a given number of characters.
PHPMailer::AddAddress function Adds a "To" address.
PHPMailer::AddAttachment function Adds an attachment from a path on the filesystem. Returns false if the file could not be found or accessed.
PHPMailer::AddBCC function Adds a "Bcc" address. Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.
PHPMailer::AddCC function Adds a "Cc" address. Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.
PHPMailer::AddCustomHeader function Adds a custom header.
PHPMailer::AddEmbeddedImage function Adds an embedded attachment. This can include images, sounds, and just about any other document. Make sure to set the $type to an image type. For JPEG images use "image/jpeg" and for GIF images use "image/gif".
PHPMailer::AddrAppend function Creates recipient headers. @access private
PHPMailer::AddReplyTo function Adds a "Reply-to" address.
PHPMailer::AddrFormat function Formats an address correctly. @access private
PHPMailer::AddStringAttachment function Adds a string or binary attachment (non-filesystem) to the list. This method can be used to attach ascii or binary data, such as a BLOB record from a database.
PHPMailer::AttachAll function Attaches all fs, string, and binary attachments to the message. Returns an empty string on failure. @access private
PHPMailer::ClearAddresses function Clears all recipients assigned in the TO array. Returns void.
PHPMailer::ClearAllRecipients function Clears all recipients assigned in the TO, CC and BCC array. Returns void.
PHPMailer::ClearAttachments function Clears all previously set filesystem, string, and binary attachments. Returns void.
PHPMailer::ClearBCCs function Clears all recipients assigned in the BCC array. Returns void.
PHPMailer::ClearCCs function Clears all recipients assigned in the CC array. Returns void.
PHPMailer::ClearCustomHeaders function Clears all custom headers. Returns void.
PHPMailer::ClearReplyTos function Clears all recipients assigned in the ReplyTo array. Returns void.
PHPMailer::CreateBody function Assembles the message body. Returns an empty string on failure. @access private
PHPMailer::CreateHeader function Assembles message header. @access private
PHPMailer::EncodeFile function Encodes attachment in requested format. Returns an empty string on failure. @access private
PHPMailer::EncodeHeader function Encode a header string to best of Q, B, quoted or none. @access private
PHPMailer::EncodeQ function Encode string to q encoding. @access private
PHPMailer::EncodeQP function Encode string to quoted-printable. @access private
PHPMailer::EncodeString function Encodes string to requested format. Returns an empty string on failure. @access private
PHPMailer::EndBoundary function Returns the end of a message boundary. @access private
PHPMailer::FixEOL function Changes every end of line from CR or LF to CRLF. @access private
PHPMailer::GetBoundary function Returns the start of a message boundary. @access private
PHPMailer::HeaderLine function Returns a formatted header line. @access private
PHPMailer::InlineImageExists function Returns true if an inline attachment is present. @access private
PHPMailer::IsError function Returns true if an error occurred.
PHPMailer::IsHTML function Sets message type to HTML.
PHPMailer::IsMail function Sets Mailer to send message using PHP mail() function.
PHPMailer::IsQmail function Sets Mailer to send message using the qmail MTA.
PHPMailer::IsSendmail function Sets Mailer to send message using the $Sendmail program.
PHPMailer::IsSMTP function Sets Mailer to send message using SMTP.
PHPMailer::Lang function Returns a message in the appropriate language. @access private
PHPMailer::MailSend function Sends mail using the PHP mail() function. @access private
PHPMailer::RFCDate function Returns the proper RFC 822 formatted date. @access private
PHPMailer::Send function Creates message and assigns Mailer. If the message is not sent successfully then it returns false. Use the ErrorInfo variable to view description of the error.
PHPMailer::SendmailSend function Sends mail using the $Sendmail program. @access private
PHPMailer::ServerHostname function Returns the server hostname or 'localhost.localdomain' if unknown. @access private
PHPMailer::ServerVar function Returns the appropriate server variable. Should work with both PHP 4.1.0+ as well as older versions. Returns an empty string if nothing is found. @access private
PHPMailer::SetError function Adds the error message to the error container. Returns void. @access private
PHPMailer::SetMessageType function Sets the message type. @access private
PHPMailer::SetWordWrap function Set the body wrapping. @access private
PHPMailer::SmtpClose function Closes the active SMTP session if one exists.
PHPMailer::SmtpConnect function Initiates a connection to an SMTP server. Returns false if the operation failed. @access private
PHPMailer::SmtpSend function Sends mail via SMTP using PhpSMTP (Author: Chris Ryan). Returns bool. Returns false if there is a bad MAIL FROM, RCPT, or DATA input. @access private
PHPMailer::TextLine function Returns a formatted mail line. @access private
PHPMailer::WrapText function Wraps message for use with mailers that do not automatically perform wrapping and for quoted-printable. Original written by philippe. @access private