Hello,

my Drupal site use simplenews + mimemail to send newsletter. After updating Simplenews to 6.x-1.1 and Mimemail to 6.x-1.0-alpha2 the newsletter can't send to test address.
I've debugged the prepare-sending process and found the problem. Overriding the test e-mail address, the mimemail_address function (in mimemail.inc) get the $address object (and not as array). If it gets array its checked is $address['name'] is not empty, but if this variable is an object it is unchecked.
So in line 576 it needs an if conditional:

// it's a user object
if (is_object($address) && isset($address->mail)) {
  if ($address->name != " ") {
    return $address->mail;
  }
  else {
    return '"'. addslashes(mime_header_encode($address->name)) .'" <'. $address->mail .'>';
  }
}

Please check it and in next update please implement this.

Thanx a lot,

DanyG

CommentFileSizeAuthor
#3 mimemail.768794_01.patch754 bytessgabe

Comments

sgabe’s picture

I can't reproduce this and can't see any changes in Simplenews 6.x-1.1 or Mime Mail 6.x-1.0-alpha2 which could be connected with this issue and could cause such like error just now. I see that mimemail_address() gets the address as an object, but I can't see any error when the $address->name is empty, the test e-mail arrives just fine. Can you give some more details?

danyg’s picture

Hi,

at the end of mimemail_prepare() function, just before send the mail to mail engine, the $message variable looks like this:

Array
(
    [address] => "" <szabod@{domain}>
    [subject] => =?UTF-8?B?W1LDqXppbmbDsyBow61ybGV2w6lsXSAyMDEwIMOhcHJpbGlz?=
[body] => This is a multi-part message in MIME format. ....

The address element of the array doesn't contain my name, just my mail address, but it stars with quotation marks.
The maillog of the server says:

2010-04-12 11:06:17.724132500 starting delivery 13142: msg 95328 to local {domain}-_<szabod@{domain}
2010-04-12 11:06:17.838565500 delivery 13142: failure: user_invalid_<szabod/invalid_username/

I've debugged the mimemail_address() function and print_r($address) and it gives the information below.

stdClass Object
(
    [name] => 
    [uid] => 0
    [mail] => szabod@{domain}
    [language] => stdClass Object
        ( ...

The name is empty and it returns with empty-quoted string.

ps. domain string is replaced beacuse of robots :P

Thanks,

DanyG

sgabe’s picture

Title: Mimemail recipient error » Check if the name is empty when the address is an object
StatusFileSize
new754 bytes

I do not understand your description now, how this can be related with just the latest version of Mime Mail and/or Simplenews. If an issue comes up after updating, the problem should be in the changes according to the previous version, but there is no such changes. It's confusing...

However, I couldn't reproduce this error entirely (the e-mails arrive fine for me), but I can confirm this can cause problems. The To header in the message with e. g. SMTP module looks like "\"\"" <example@{domain}> this is as least ugly but rather totally bad.

Please, test the attached patch and if it works, mark the issue as RTBC.

danyg’s picture

Status: Active » Reviewed & tested by the community

Thanks,

I've tried the patch and it works. Early I've tried the if condition with empty() but it didn't send the letter, and now the empty() condition in patch it works. I don't understand :)
Thank You once again. Kösz Gábor, mégegyszer.

sgabe’s picture

Version: 6.x-1.0-alpha2 » 7.x-1.x-dev

Changing version to HEAD.

sgabe’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD.

Status: Fixed » Closed (fixed)

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