Invalid address: Array

Fatal error: Uncaught exception 'phpmailerException' with message 'SMTP Error: Data not accepted.' in /usr/home/mikeyao/htdocs/legato/sites/all/modules/phpmailer/phpmailer/class.phpmailer.php:757

Stack trace:
#0 /sites/all/modules/phpmailer/includes/phpmailer.class.inc(84): PHPMailer->SmtpSend('Return-Path: mi...', 'This is a multi...')
#1 /sites/all/modules/phpmailer/includes/phpmailer.mimemail.inc(72): DrupalPHPMailer->SmtpSend('Return-Path: mi...', 'This is a multi...')
#2 /sites/all/modules/phpmailer/phpmailer.module(81): mimemail_phpmailer_send(Array)
#3 /sites/all/modules/mimemail/mimemail.module(174): phpmailer_mailengine('send', Array)
#4 /sites/all/modules/mimemail/mimemail.module(282): mimemail('mikeyao1@sina.c...', NULL, 'Signup wishlist', '<p>You have add...', NULL, Array, NULL, Array, '')
#5 /includes/mail.inc(177): drupal_mail in /sites/all/modules/phpmailer/phpmailer/class.phpmailer.php on line 757
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

yaoweizhen’s picture

Version: 6.x-3.0-rc1 » 6.x-2.1
smk-ka’s picture

Component: Miscellaneous » Code
Status: Active » Postponed (maintainer needs more info)

Could you give some more details about what triggered the email (i.e. which module tries to send an email), and the module version of Mime Mail? I'm asking, since obviously the recipient (second parameter in the mimemail() call) is NULL: mimemail('mikeyao1@sina.c...', NULL, ...), which looks wrong.

smk-ka’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

Sorry, without further information this issue can only be marked as won't fix.

Feel free to re-open this issue if you want to provide further information. Thanks.

boabjohn’s picture

Title: error » Invalid address error
Category: support » bug
Status: Closed (won't fix) » Active

Sorry to re-open, but am casting the net widely and see this issue as related:

http://drupal.org/node/748030#comment-2907516

Thanks for any input...

Running: // $Id: phpmailer.module,v 1.4 2009/05/07 04:33:19 sun Exp $

boabjohn’s picture

It seems like the error is someplace around here (note the error being thrown):

  /**
   * Adds a "Reply-to" address.
   * @param string $address
   * @param string $name
   * @return boolean
   */
  public function AddReplyTo($address, $name = '') {
    return $this->AddAnAddress('ReplyTo', $address, $name);
  }

  /**
   * Adds an address to one of the recipient arrays
   * Addresses that have been added already return false, but do not throw exceptions
   * @param string $kind One of 'to', 'cc', 'bcc', 'ReplyTo'
   * @param string $address The email address to send to
   * @param string $name
   * @return boolean true on success, false if address already used or invalid in some way
   * @access private
   */
  private function AddAnAddress($kind, $address, $name = '') {
    if (!preg_match('/^(to|cc|bcc|ReplyTo)$/', $kind)) {
      echo 'Invalid recipient array: ' . kind;
      return false;
    }
    $address = trim($address);
    $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
    if (!self::ValidateAddress($address)) {
      $this->SetError($this->Lang('invalid_address').': '. $address);
      if ($this->exceptions) {
        throw new phpmailerException($this->Lang('invalid_address').': '.$address);
      }
      echo $this->Lang('invalid_address').': '.$address;
      return false;
    }
    if ($kind != 'ReplyTo') {
      if (!isset($this->all_recipients[strtolower($address)])) {
        array_push($this->$kind, array($address, $name));
        $this->all_recipients[strtolower($address)] = true;
        return true;
      }
    } else {
      if (!array_key_exists(strtolower($address), $this->ReplyTo)) {
        $this->ReplyTo[strtolower($address)] = array($address, $name);
      return true;
    }
  }
  return false;

smk-ka’s picture

Please update to the 2.x development snapshot first, as 2.1 is a rather old release. 2.x contains a more advanced e-mail address parser, and I'd like to see whether the bug is still occurring then.

boabjohn’s picture

G'Day: Just tested with both 2.x dev and 3.x rc1

Both versions throw the same Invalid address error (which seems to come from the phpmailer.class) and in addition I get this error:

warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'phpmailer_settings_access' was given in /mysite/htdocs/drupal/includes/menu.inc on line 452.

Lastly, I noted in drush that on updatedb the system is reporting this (twice):

PHP Warning:  Module 'mailparse' already loaded in Unknown on line 0
PHP Warning:  Module 'mailparse' already loaded in Unknown on line 0

Sorry if this is a bit of issue bloat...it's a pretty confusing set of factors to try to unravel, I find. PHPMailer is required in at least three places I've found:

- phpmailer module wants the class for itself, but just two files from the package
- smtp wants it as well, and make sure to rename the package to lowercase
- messaging wants it, and make sure you *don't* make it lowercase, but *do* drop the version number.

It's no wonder that somewhere along the line there's some crossed wires.

If I've got the configuration stack all wrong, please let me know...but I can't see how to get the job done otherwise.

Thanks in advance!

smk-ka’s picture

Version: 6.x-2.1 » 6.x-2.x-dev
Status: Active » Fixed
FileSize
4.57 KB

I've just updated the email parser and added some new tests to make sure all sorts of plain, escaped, as well as base64 encoded addresses are properly parsed and decoded before handed to PHPMailer (the library). Attaching the patch for reference only, as branches are already updated.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.