You are here

public function PHPMailer::set in SMTP Authentication Support 7

Same name and namespace in other branches
  1. 7.2 smtp.phpmailer.inc \PHPMailer::set()

Set (or reset) Class Objects (variables)

Usage Example: $page->set('X-Priority', '3');

@access public

@todo Should this not be using __set() magic function?

Parameters

string $name Parameter Name:

mixed $value Parameter Value: NOTE: will not work with arrays, there are no arrays to set/reset

File

./smtp.phpmailer.inc, line 2155
The mail handler class in smtp module, based on code of the phpmailer library, customized and relicensed to GPLv2.

Class

PHPMailer
PHPMailer - PHP email transport class NOTE: Requires PHP version 5 or later @package PHPMailer @author Andy Prevost @author Marcus Bointon @copyright 2004 - 2009 Andy Prevost

Code

public function set($name, $value = '') {
  try {
    if (isset($this->{$name})) {
      $this->{$name} = $value;
    }
    else {
      throw new phpmailerException(t('Cannot set or reset variable: !name', array(
        '!name' => $name,
      )), self::STOP_CRITICAL);
    }
  } catch (Exception $e) {
    $this
      ->SetError($e
      ->getMessage());
    if ($e
      ->getCode() == self::STOP_CRITICAL) {
      return FALSE;
    }
  }
  return TRUE;
}