I upgraded mimemail to latest dev version. Now, I have following error whenever I tried to send simplenews newsletter. Please help!
mail() [<a href='function.mail'>function.mail</a>]: Bad parameters to mail() function, mail not sent. in /home/content/n/e/p/nepfor/html/sites/all/modules/mimemail/mimemail.module on line 331.

Comments

jerdavis’s picture

What version of simplenews?

Colossus’s picture

Parameter-Problem too ! Mail not sent !

Drupal 6.9
Simplenews 6.x-1.0-rc5
Mime Mail 6.x-1.x-dev (2009-Feb-22)

preg_match() expects parameter 2 to be string, array given in /web/1/000/015/530/15195/htdocs/emmy-eltern-neu/includes/bootstrap.inc in Zeile 761

jasonteknut’s picture

I am also experiencing this issue. As a possible clue to the cause, I am hosted on godaddy, which may be a commonality between those of us experiencing this bug.

jerdavis’s picture

Status: Active » Postponed (maintainer needs more info)

It's a possibility. Although I don't believe anything has changed that would account for a problem there. It would be helpful to know the version of PHP you're on.

Also, if you can add a couple of print_r() statements to aid with debugging, I'd be interested to know what you're getting passed for each of the mail() parameters from Simplenews.

Jer

steve22’s picture

I removed mimemail module and upgraded to latest simplenews, the error went away.

jasonteknut’s picture

By removing mimemail, you force simplenews to use the drupal_mail functions, which are not capable of HTML based emails.

The contents of the $message variable on line 1641 in simplenews.module appear to be valid...except that the "from" and reply-to fields are non-email address in nature. Don't know if that can cause any problems.

Ed Ropple’s picture

preg_match() expects parameter 2 to be string, array given in /WWWPATH/www/newsite.republicanproject.org/includes/bootstrap.inc on line 771. (within drupal_validate_utf8)

Found in Drupal 6.10 with Simplenews 6.x-1.0-rc6 and SMTP 6.x-1.0-beta3. Does not occur with mimemail removed but does occur without SMTP, so I'm pretty sure it's a mimemail issue. Tried to get print_r output, but it gets washed away in the spam, sorry.

jday’s picture

I've uninstalled mimemail, cleared caches and still get the error, is there something the uninstall misses that has to be deleted manually?

Colossus’s picture

What do I have to do with these "print_r()" statements ?
Where to do it ?
I'm very interested in getting this fixed - so please tell me what to do.

jasonteknut’s picture

The problem is in the subject. In mimemail.module line number 329:

foreach ($message['address'] as $a) {
$status = mail(
$a,
-----> $message['subject'], <-------------PROBLEM IS HERE----------------
$message['body'],
mimemail_rfc_headers($message['headers'])
) && $status;

If you replace this line with 'test test test', the email will be sent.

Did a print_r on this line and got the encoded line:
=?UTF-8?B?W0F3ZW5kYXcgR3JlZW4gTmV3c2xldHRlcl0gQUcgTmV3c2xldHRlciBOb3cgT24=?= =?UTF-8?B?bGluZQo=?=

Which, when entered into the subject line of gmail, does correctly display upon receipt as:
[Awendaw Green Newsletter] AG Newsletter Now On line
(notice the space between 'On' and 'line' - this space should NOT be there...also notice that there are TWO UTF-8 encoded sections in the print_r output)

Why this is rejected by the mail() function is the question.

jasonteknut’s picture

The problem is that the subject is too long. When the subject line gets too long, the UTF-8 encoded message gets split into two parts as you can see in the print_r example.

If you shorten your newsletter name and the subject line for the message, the error goes away.

I'm not sure if this can be fixed in mimemail, but that's the problem!

frankcarey’s picture

oops replied to wring issue ;)
[deleted]

Ken Knowles’s picture

I had the same problem and found the problem with drupal_html_to_text. See issue "#438058: Remove line feeds in subject" for description and patch.

j0rd’s picture

Had the same issue with Simplenews with mimemail. Just updated to the latest mimemail DRUPAL--6-1 and it seems to have resolved the issue.

Here's some text so people can find the error easier from google.

warning: preg_match() expects parameter 2 to be string, array given ... /bootstrap.inc on line 771.

drupal_validate_utf8
webel’s picture

Same problem whenever I use more than one word in the title of my newsletter (English).

avillager’s picture

For sending mails through contact forms, for me the patch in #84883: Unicode::mimeHeaderEncode() doesn't correctly follow RFC 2047 (comment #77) resolved the issue. See my versions in #81

sgabe’s picture

Priority: Critical » Normal
Status: Postponed (maintainer needs more info) » Closed (duplicate)

It seems that this is already fixed by #438058: Remove line feeds in subject.