1 sam2kb Jan 11, 2008 22:16
3 sam2kb Jan 11, 2008 23:06
Thank you for getting in.
The output is
Warning: mail() [function.mail]: Bad parameters to mail() function, mail not sent. in /.../inc/_core/_misc.funcs.php on line 1766
bool(false)
4 sam2kb Jan 11, 2008 23:13
if I use contact form I get bool(true)
5 afwas Jan 11, 2008 23:15
The headerstring looks to be $debug only, try:
$r = mail($to, $subject, $message, $headers);
var_dump($r);
6 sam2kb Jan 11, 2008 23:53
Ok, I got this with $debug = 2
Sending mail from «b2evo@myhost» to «valid email», Subject «=?ISO-8859-1?B?0J/QvtC00YLQstC10YDQtNC40YLRjCDQstCw0YggZW1haWwg0LDQtNGA?= =?ISO-8859-1?B?0LXRgSDQtNC70Y8gIm5ldzEi?=» FAILED.
didn't check it for contact form yet
7 afwas Jan 11, 2008 23:58
Back to basics
There must be an active mail() function because if I add:
mail($to, $subject, $message, $headerstring)
I get two emails. So
The function should work as advertised
mail($to, $subject, $message, $headerstring) also should function
I still cannot find mail()
Your problem is related to the GoDaddy setup.
[/list:o]
If you do $debug=1 in /conf/_advanced.php, does it give extra and interesting debug info?
8 sam2kb Jan 12, 2008 00:23
I'm now trying to resolve it. Will post my solution here. Thanks
9 sam2kb Jan 12, 2008 00:35
I added my own subject
$subje = "Some subject";
mail($to, $subje, $message, $headerstring)
and message was sent!
Moving forward...
10 sam2kb Jan 12, 2008 00:44
I forgot to tell that the subject of the mail sent from contact form is always like РлекСандС.
It seems to be the same problem with registration, but in this case it sends something very bad in Subject :)
11 afwas Jan 12, 2008 00:46
Can it be it goes wrong in this piece?
// Convert encoding of message (from internal encoding to the one of the message):
$message = convert_charset( $message, $current_charset, $evo_charset );
/inc/_core/_misc.funcs.php lines 1763-1764
if( function_exists('mb_encode_mimeheader') )
{ // encode subject
$subject = mb_encode_mimeheader( $subject, mb_internal_encoding(), 'B', $NL );
}
lines 1756-1759
12 sam2kb Jan 12, 2008 00:52
Ok, I renamed ru-RU folder in locales and everything works fine with regular subject string. It is an encoding problem
13 afwas Jan 12, 2008 00:56
sam2kb wrote:
Ok, I renamed ru-RU folder in locales and everything works fine with regular subject string. It is an encoding problem
Cool
Getting somewhere
14 afwas Jan 12, 2008 00:59
/xmlsrv/message_send.php lines 221-222
// We don't know the recipient's language - Change the locale so the email is in the blog's language:
locale_temp_switch($Blog->locale);
But i presume you noticed this already. Now simply try to get the $subject out of there
15 sam2kb Jan 12, 2008 06:12
All right, here is the solution (at least for me on UTF-8 with Russian text).
In /inc/_core/_misc.funcs.php on line 1756 I changed
$subject = mb_encode_mimeheader( $subject, mb_internal_encoding(), 'B', $NL );
to
$subject = "=?utf-8?B?". base64_encode($subject). "?=";
Validation messages sent perfect! And this part is done.
I'm not a dev, so I let you guys to work around :)
But when I send messages with contact/comment form, the recipient_name and sender_name are always in wrong encoding (actually they're not encoded at all)
To: ааЛаЕаКбаАаНаДб
Subject: =?utf-8?B?0JDQu9C10LrRgdCw0L3QtNGA?=
From: ааЛаЕаКбаАаНаДб
Now I'm working on it.
EDIT: this also works with
$subject = "=?$evo_charset?B?". base64_encode($subject). "?=";
16 sam2kb Jan 12, 2008 07:13
To encode TO: and FROM: fields
open /htsrv/message_send.php find and change
on line 113
$sender_name = param( 'd', 'string', '' );
$sender_name = "=?$evo_charset?B?". base64_encode($sender_name). "?=";
on line 191
$recipient_name = trim($recipient_User->get('preferredname'));
$recipient_name = "=?$evo_charset?B?". base64_encode($recipient_name). "?=";
on line 220
$recipient_name = trim($Comment->get_author_name());
$recipient_name = "=?$evo_charset?B?".base64_encode($recipient_name). "?=";
Now my blog IS multilingual :)
17 sam2kb Jan 12, 2008 09:43
After several tests I found that the comments aren't have encoded FROM string, while registration and contact forms work perfect.
I give up... :(
18 sam2kb Jan 26, 2008 07:57
Can we move this topic in bugs section. This problem is not fixed in 2.4.0 version. All headers sent unencoded.
All emails coming from my blog have unreadable headers, and I can't set email validation for users because mail() function fails.
Does anybody here use non-latin Language packs?
19 sam2kb Apr 10, 2008 05:29
bump
Why the mail function doesn't encode the headers? We can add a simple 3-lines patch and the problem is gone.
20 fplanque Apr 11, 2008 00:14
OK I'll check that out for the next release.
21 sam2kb Apr 11, 2008 00:15
Thanks
22 fplanque Apr 12, 2008 22:15
OK, I have added a "clean" version of this to CVS.
By clean I mean it's not going to break the tests for empty strings or pass something weird to the plugins.
Have a look.
23 sam2kb Apr 12, 2008 23:29
I tried that, it doesn't fix validation emails. I thought of doing it globally by adding something like this in mail function in _misc.funcs.php.
I'm not a regex expert so there might be a better solution, but I use this code and it works perfect.
$from_name = preg_replace( '/^(.+?)<(.*?)>$/', '$1', $from );
$from_email = preg_replace( '/^.*?<(.+?)>$/', '$1', $from );
//$from_name = '' in validation messages
if ( $from_name != $from_email )
{
$from = "=?$evo_charset?B?".base64_encode( $from_name )."?=".' <'.$from_email.'>';
}
$headers['From'] = $from;
$subject = "=?$evo_charset?B?".base64_encode($subject)."?=";
24 fplanque Apr 13, 2008 17:20
Ok, I have moved all the base64_encodes into send_mail() and I've added it to $to, $from and $subject.
Can you check again?
Also, can you please confirm what you get when you go to Admin > Tools > System under "PHP mbstring extension" ?
Thanks.
Looks like the mail() function is missing in B2evo :?:
Try to add:
in line 1765 of file /inc/_core/_misc.funcs.php
line 1765 is currently a blank line, line 1766 reads: if( $debug > 1 )
and report back to this topic.
Good luck