Hi.

When I create a user, or in general wants the system to send an email, I get this error:

Warning: mail(): Bad parameters to mail() function, mail not sent. i DefaultMailSystem->mail() (linje 77 af /hsphere/local/home/[site]/modules/system/system.mail.inc).
Can't send email. Contact the administrator if this continues.

Well. Safe-mode's off. I run PHP 5.2.17 from a Linux server and I'm testing from Win7 and both IE and FF. Only admins are allowed to create users.

I have no clue at all of what to do. Please help me.

Comments

cbh’s picture

Same problem here on a Lunux system, current versions of Drupal and Backup and Migrate, which is having the mail problem. Message for me is:
warning: mail(): Bad parameters to mail() function, mail not sent. in /hsphere/local/home/mydomain/sites/all/modules/backup_migrate/includes/destinations.email.inc on line 139.

yanchen’s picture

Same here. Hosted on Godaddy.com. If you change the mail to all English, the problem is gone.

cbh’s picture

I'm not sure what you mean by changing the mail to "all english" - where would I do that. The site language is already english. I'm using the Mime Mail module and there's no language preference indicated there.

MLynnerup’s picture

Version: 7.0 » 6.22

Hi,

I'm having the excaltly same problem in 6.22 on a Linux host. Running all english (install language) no problems, while when I change to Danish I consistently receives the error message - though the mail is sent.

Any clues?

oadaeh’s picture

Version: 6.22 » 7.0
Category: bug » support

To everyone, what other mail modules do you have installed and enabled on your systems?

The ones I am particularly interested in are Mail System, Mime Mail, PHPMailer and SMTP Authentication Support, but there could be others.

I suspect your problems are being caused by toxic interaction with one or more contrib modules.

@MLynnerup: you cannot possibly be having exactly the same problem, as DefaultMailSystem->mail() is not in Drupal 6. I suggest you re-examine your error message(s), but it is still probably caused by toxic interaction with one or more contrib modules.

ozili’s picture

Assigned: ozili » Unassigned
Status: Closed (works as designed) » Active
ozili’s picture

Assigned: Unassigned » ozili
Status: Active » Closed (works as designed)

After a lot of time spending on it, I think I found the solution.
If you have the message telling you that you have bad parameters in " /modules/system/system.mail.inc " :
in the file system.mail.inc, just replace

$mail_subject = mime_header_encode($message['subject']);

with

$mail_subject = str_replace("\n", ' ', mime_header_encode($message['subject']));

I hope it will help you
Best regards and sorry for my poor english...

oadaeh’s picture

Status: Active » Postponed (maintainer needs more info)

@ozili: that's the wrong solution. The next time you upgrade Drupal, you'll have to remember to make that fix again.

The real fix is to find out which module is setting that subject and have the maintainer of that module fix their code.

I can help you with the fix, if you can determine the module that is causing the problem.

I'm also re-opening the issue until I hear back from the OP (or don't hear back at all).

ozili’s picture

ok sorry...

bigbigT’s picture

Version: 7.0 » 7.8
Assigned: Unassigned » bigbigT

I am using 7.8, and the same problem. I find out that the problem occurs when using Hsphere , when I am using Cpanel, there is no such problem.
Warning: mail(): Bad parameters to mail() function, mail not sent. in DefaultMailSystem->mail() (line 87 of /hsphere/local/home/mysite/modules/system/system.mail.inc).

bigbigT’s picture

I have tried ozili's method, it doesn't work for drupal 7.8. On the contrary, it may cause more serious problems.

bigbigT’s picture

I have solved the problem.

We have this problem because we are using non-English characters in the mail we send to users(I am using Chinese).

To solve it, just go to Configuration-Account settings, to change all the default mail content "[site:name]" to English.

acavayas’s picture

I have exactly the same problem. I tried to switch to english but the problem persists!
I am hosted on godaddy...
Any other idea on how to fix this?

margunnarsson’s picture

Yes #12 is a bit unclear.
If I remember correctly I went to admin/config/people/accounts/settings and in the Subject of the Email template ( bottom of the page ) make sure there are no special chars.
(I think its OK to have it in the Body, please test)

orozcoraulm’s picture

Yes #12 and #14.
I had the same problem and after making changes in mail.inc in order to review the mail() function passed parameteres, i found special characters in the string from the Site Information/Name value. I edited the name in order to eliminate all special characters and all worked fine.
In summary: do not use special characters in the Site Information/Name.

dddave’s picture

Assigned: bigbigT » Unassigned
Status: Postponed (maintainer needs more info) » Fixed

per #15

Status: Fixed » Closed (fixed)

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

juanhc’s picture

Yes #15. Im use Drupal Core 7.22. In my case i need my site in spanish (and i still use this language) and im working with the Forward module. The $mail_subject variable in system.mail.inc don't accept special characters. When the subject for the email collect the [site:name], the [forward:sender] (used in the Forward module) and the "Forward Message Body" field (from the same module) if any of this have an accent or special character not send the email for the RECIPIENT, but sends the email confirmation for the sender. Maybe a function for replace the special characters in the $mail_subject variable?