I switched from the simple mail sending method to the PHPMailer sending method. It works fine when I create forum topics. However I keep getting an error when I create a different content type:
"invalid address: firstname.lastname"

firstname.lastname is my username.

Comments

BetaTheta’s picture

any help with this?

My users receive notifications and the content does get created. However it's just annoying to get a white page stating : invalid username every time I create new content.

jose reyero’s picture

Status: Active » Postponed (maintainer needs more info)

Looks like the phpmailer module may have trouble with sender names with a dot.

Please change the user name and confirm this is the issue.

deaman’s picture

Status: Postponed (maintainer needs more info) » Active

I have seen this error as well, when adding calendar events (not forum for some reason) to my site I get the invalid address error.

The source the warning address is:

"Invalid address: dean <my_address@yahoo.com.au>"

I tracked it back to
./sites/all/modules/messaging/PHPMailer/class.phpmailer.php
the function AddAnAddress calls ValidateAddress. passing in the reply to header.

which then traced back to the reply to address in messaging_phpmailer.module, line 167 or so.

I am not sure why this is not manifesting for more people, or what the correct solution is, but commenting out the reply to email header removed the error for me.

  if(!empty($message['headers']['Reply-To'])) {
  //  $mail->AddReplyTo($message['headers']['Reply-To']);
  }

bit of a cludge, but as I am only specifying an invalid email address, the reply to may as well be empty for my site. It seems that for php 5.2 ValidateAddress uses a different algorithm to validate emails. I am running php 5.2 so perhaps this is relevant to who has the issue or not.

This is my first significant post here, I welcome any comments or requests on the information I provide in my attempt to help. :)

Thanks,

Dean

heltem’s picture

#3 : Same issue here.

tmetzger’s picture

Yup me too. Painful.

gausarts’s picture

Subscribing. Thanks

tmetzger’s picture

No action on this one huh? That's unfortunate. Is this something that needs to be fixed by the phpmailer people?

jose reyero’s picture

Status: Active » Postponed (maintainer needs more info)

1. I'm not using phpmailer so please someone tells me if it is specific email addressed or all addresses that cause trouble. See #2

2. Try changing the notifications settings to Notifications Sender: "no one", does it fix the issue?

3. Why valid addresses for generic mail cause trouble in PHPMailer. It may be PHPMailer issue?

heltem’s picture

Well,

A Reply-To address should comply to the Addr-Spec (http://tools.ietf.org/html/rfc5322#page-17) and does not contain the display-name part.
PHPMailer does follow the rules and rejects the address+display-name provided by messaging call to AddReplyTo().

Regards

boabjohn’s picture

Glad to have found this thread: coming at it from a simplenews context where there is actually no email address involved at all...the error is apparently thrown when simplenews passes the value of the *from name* (not email) to one of the modules:

- phpmailer
- smtp
- messaging

I found this threads that seem related: http://drupal.org/node/749506

And my full problem report is here: http://drupal.org/node/748030

FWIW (repeating), a grep on "Invalid address" in my system returns:

./smtp/phpmailer/test/phpmailerTest.php: $this->assertFalse($this->Mail->AddAddress('a@example..com'), 'Invalid address accepted');
./smtp/phpmailer/class.phpmailer.php: 'invalid_address' => 'Invalid address',

./messaging/messaging_phpmailer/PHPMailer/test/phpmailerTest.php: $this->assertFalse($this->Mail->AddAddress('a@example..com'), 'Invalid address accepted');
./messaging/messaging_phpmailer/PHPMailer/class.phpmailer.php: 'invalid_address' => 'Invalid address',

./phpmailer/phpmailer/class.phpmailer.php: 'invalid_address' => 'Invalid address',
./phpmailer/phpmailer/PHPMailer_v5.1/test/phpmailerTest.php: $this->assertFalse($this->Mail->AddAddress('a@example..com'), 'Invalid address accepted');
./phpmailer/includes/phpmailer.class.inc: 'invalid_address' => 'Invalid address',

Definitely interested in helping resolve this one...

ozecho’s picture

Hi,

I am experiencing the same issue.

I noticed that for some reason I had checked the "Notify poster of own posts" in /admin/messaging/notifications/settings.

Once I turned this off (which is the default and maybe why more people arent finding this) I no longer experienced the error.

edit:
Seemed to solve it for one use case, but not for others. still looking for a solution to this one. Ugh.

It feels like its not something wrong with the PHP Mailer, but instead with something in Notifications... maybe an incorrect call? It also seems to have something to do with the "Notifications Sender:" setting.....

boabjohn’s picture

Status: Postponed (maintainer needs more info) » Active

Howdy all,

I sent a message to the fella from Codeworx who is named on the phpmailer class, but have gotten no response in 3 weeks.

None of the module maintainers have responded yet (messaging, smtp, phpmailer)

It's pretty tragic trying to use simplenews and getting an error for every single subscriber.

Changing the status here as I'm not sure what other information might actually be needed. Jose?

ozecho’s picture

Hi deaman,

thanks for your post #3... it pointed me in the right direction, and whilst commenting out the reply to line worked, it stopped another module which sets the "reply to" to stop working for me (mail comment), so I did the following.

  if(!empty($message['headers']['Reply-To'])) {
     if (preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/", $message['headers']['Reply-To'])) {
        $mail->AddReplyTo($message['headers']['Reply-To']);
    }      
  }

Although this is still a fudge, it stops the error when the replyto address is wrong.

The problem is going to be in some other module (notifications???) that is passing the replyto address with a Name followed by the email address, rather than just the email address.

Hope this helps others until the issue is really resolved.

nicktr’s picture

2. Try changing the notifications settings to Notifications Sender: "no one", does it fix the issue?

This fixed it for me! There must still be a deeper problem though. Will be keeping track on this post.