Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Mail() function not working
Interesting that your zem? contact form works but your comments and user name/ password functions don’t. A host that we use, Mosso (Now called Rackspace Cloud), required the fourth parameter to be added for PHP Mail to work. Ruud kindly provided the ability to do that by adding the SMTP envelope preference in TXP 4.0.7. However, one has to hack at plug-ins like zem contact reborn which also uses PHP Mail(). It may be that the lady I talked to at IX Web Hosting was wrong or that their PHP is set up incorrectly (or both :-{ ).
You can try sidestepping PHP mail entirely. See this forum post. I also host some sites on WebFaction who do not support PHP mail at all. We now use this method on all sites we host on both Mosso and WebFaction for commonality through TXP and plugins that send mail. It’s easy to do and there are good instructions.
Offline
Re: Mail() function not working
The problem is NOT the use of multiple words in the site name, but the length of the site name.
I have TXP 4.20 installed and the same PHP version (5.2.6), so I tried using the sitename Косово и Метохија
while adding a new author. No problem. The email is sent without any error. If I look at the resulting email, as a user you would see that the subject line says: [Косово и Метохија] Your login info
, but if I look at how exactly that is transmitted, I see: Subject: =?UTF-8?B?W9Ca0L7RgdC+0LLQviDQuCDQnNC10YLQvtGF0LjRmNCwXSBZb3VyIGxvZ2lu?= =?UTF-8?B?IGluZm8=?=
(all on one big line).
That surprised me, because it should’ve looked like this (each of the encoded chunks on a separate line to avoid lines in the mail header longer than 74 bytes to comply with the relevant RFC):
Subject: =?UTF-8?B?W9Ca0L7RgdC+0LLQviDQuCDQnNC10YLQvtGF0LjRmNCwXSBZb3VyIGxvZ2lu?=
=?UTF-8?B?IGluZm8=?=
When you used a shorter site name, the subject becomes shorter and it all fits inside one encoded chunk, so there’s no need for a linebreak in the subject header.
I suspect that PHP doesn’t like the type of linebreaks used. As you may know, there’s a difference in linebreaks between Windows (\r\n) and Unix (\n). In the PHP manual for the mail() function, you’ll find:
Note: If messages are not received, try using a LF (\n) only. Some poor quality Unix mail transfer agents replace LF by CRLF automatically (which leads to doubling CR if CRLF is used). This should be a last resort, as it does not comply with » RFC 2822.
TXP used a LF (\n) at all times when using a Unix MTA (mail transfer agent)… but what if that’s what’s causing the problems you have? So I did a little testing, forcing the linebreak in the subject line to use CRLF (\r\n) and in the resulting email I got a subject with encoded chunks on 2 separate lines as intended.
Would you mind testing something? In the file textpattern/lib/txplib_misc.php
in the function encode_mailheader you’ll find this on line 1134:
$sep = is_windows() ? "\r\n" : "\n";
Can you try changing that to (to always force it to Windows line endings for mime-encoding the mail header) and test with your original longer cyrillic site name:
$sep = is_windows() ? "\r\n" : "\n"; $sep = "\r\n";
And if that doesn’t work, change it to (shouldn’t have any effect, assuming the is_windows function returns false as it should on your Linux server):
$sep = is_windows() ? "\r\n" : "\n"; $sep = "\n";
Or else (makes no sense, but who knows…):
$sep = is_windows() ? "\r\n" : "\n"; $sep = "\r";
Offline
Re: Mail() function not working
IT WORKS! EMAIL NOTIFICATIONS ARE WORKING NOW! :)))
@ruud
the third option, the one that makes no sense, but who knows :) is the solution.
Not only on this cyrilic web site, but I also add that line on my other site that was having the same problem with email notification when someone leave a comment on the blog (and btw that site is on latin, so its not about cyrilic I guess).
Now everything works on both sites! THANKS A LOT!
So, bottom line, wth was the problem :) Is it the server configuration or bug in txp?
@joebaich
thanks, nice to know about that option, just in case. I’m swithing hosting anyway, these guys are in some serious troubles.
Oh, there is one more thing, now I see. When I run diagnostics I get this:
Some Textpattern files have been modified:
/hsphere/local/home/c25/*.com/textpattern/lib/txplib_misc.php
Should I wory about that? Everything works, as far as I can see…
Offline
Re: Mail() function not working
It would be interesting to know which Linux distribution is installed on that server and which mailserver software (MTA) is installed (and which version), because this is really strange. I’ve tried this myself on both Postfix and Exim (both well known MTAs) and could not reproduce your problem.
I don’t think it’s a TXP bug. Could be non-standard behaviour of the mail transfer agent (MTA) installed.
PS. since you DID modify txplib_misc.php, it’s normal that it shows up as modified on the diagnostics tab.
Offline
Re: Mail() function not working
AndrijaM wrote:
Should I wory about that? Everything works, as far as I can see…
You don’t have to worry about it. It throws out the notification, because you did modify the file. It would be odd if it didn’t nag about it ;)
Edit. I should check for new replies after reading the posts…
Last edited by Gocom (2009-09-08 11:29:54)
Offline
Re: Mail() function not working
Just contacted the hosting company, it’s this version of Linux:
CentOS release 5 (Final)(i386)
And for the MTA here’s what thay said:
All domains with email enabled, including those on Windows plans are hosted on our Linux based email servers. These servers use qmail as their MTA. Note that each domain may end up on a different mail server, even for the same account type. This finer grained provisioning allows us to spread the load better
hope that helps
Thanks Gocom, sorry to bother you with this problem on rah_comment_spam plugin, but it was really strange also, when I deleted the plugin comments were working on that web site (the latin one here), after instaling it again they stoped working. Now, after this change, they work with plugin installed
Offline
Re: Mail() function not working
Filed as TXP issue 38
Offline
Re: Mail() function not working
Today i created four different users – two with gmail email addresses and two with non gmail email addresses.
When i login as any of the two users with GMAIL addresses and change my password i don’t RECEIVE an email notification with the new password.
BUT when i do the same with the other two users using non-gmail address both users receive email notifications.
NOTE all four users receive the PRIMARY first email notifying them that they have been created and their login password.
Why no email when they change their password. has this “gmail bug” not been addressed in Textpattern CMS · 4.5.1?
…. texted postive
Offline
Re: Mail() function not working
Hi bici
I know it s obvious but have you checked spam folder!
Offline
Re: Mail() function not working
Which Gmail bug are you referring to? We do not treat any mail host different.
Offline
Re: Mail() function not working
Dragondz wrote:
Hi bici
I know it s obvious but have you checked spam folder!
yes.
Last edited by bici (2013-01-28 07:13:47)
…. texted postive
Offline
Re: Mail() function not working
wet wrote:
Which Gmail bug are you referring to? We do not treat any mail host different.
this one http://code.google.com/p/textpattern/issues/detail?id=38
…. texted postive
Offline