Validation email not being received 1.9.8, error shows in log.

On a fresh install email wasn't working. I nuked the installation and the database but not the data directory. I uploaded the zip file and did a fresh installation. I viewed the server error log which shows this error.

[Tue Mar 03 19:51:48 2015] [5928640] [fcgid:warn] [client 99.249.38.154:61626] mod_fcgid: stderr: PHP WARNING: 2015-03-03 21:51:48 (EST): "mail() [<a href='function.mail'>function.mail</a>]: Bad parameters to mail() function, mail not sent." in file /home/content/40/5928640/html/hostedsites/weconnectat.ca/hnphockeylondon/engine/lib/notification.php (line 683), referer http://weconnectat.ca/hnphockeylondon/register

I checked the file notification.php (line 683) and it has:

return mail($to, $subject, $body, $headers_string);

It looks pretty straight forward. My other 1.9.8 installation has been working ok.

Any suggestions? Could it be a corrupted file? the email address is valid.

  • nuking the installation seems like overkill - are you using any plugins that modify the email - for html email for example?

    Worst case you know the line, you can error log the parameters being sent to it to see what is bad.

  • I agree nuking the installation was probably overkill. Since it was a fresh installation, 30 minutes old with just a few plugins added, I figured it would be faster to nuke it then try to track down the issue.

    This is a fresh, not even five minutes old installation, with only the core stuff that is in the 1.9.8 archive. I know sometimes it gives the best error it can.

    The only error is what is in the error log that I posted above, elgg doesn't appear to show any error. When I do the test registration it says it is sent.

    I've tried re-uploading the notification.php, I'm going to try re-uploading the /engine folder to see if that fixes the problem.

     

  • I think I have figured out the cause which doesn't make sense, then question is, what is the solution.

    The only difference I could think of between my two Elgg 1.9.8 installations where for one email validations worked and the other where they didn't was the name of the folder. In the elgg that works it is installed in www.mydomain.com/elgg and the one that it doesn't work in is www.mydomain.com/notelgg.

    To test my theory I did another fresh installation of elgg in www.mydomain.com/elgg on the same domain with the same email address for the system and validation emails work.

    It appears that if elgg is installed in the / or in /elgg it's ok but if you have the sub-directory a different name the validation email isn't working.

    In my situation I must be able to use different folder names because I will be doing multiple installations of elgg.

    Can anyone provide a code change to fix this problem?

    Thanks,
    Dan

  • I don't see how that could possibly affect email headers... can you get a dump of those bad headers?

  • Other than what is in the server error log I don't know how to get a dump of the bad headers.

    As I posted above this is what the server log shows as an error.

    [Wed Mar 04 10:53:07 2015] [5928640] [fcgid:warn] [client 99.249.38.154:58578] mod_fcgid: stderr: PHP WARNING: 2015-03-04 12:53:07 (EST): "mail() [<a href='function.mail'>function.mail</a>]: Bad parameters to mail() function, mail not sent." in file /home/content/40/5928640/html/hostedsites/weconnectat.ca/hnphockeylondon/engine/lib/notification.php (line 683), referer http://weconnectat.ca/hnphockeylondon/register

    If you can explain to me how I can get a dump of the bad headers I'm happy to do so.

    If you need a link to my site it's at the end of the error.

    When you register it doesn't give any error on the screen, it says the email was sent but it never arrives. When I check the email account for the email address it also doesn't show against the 250 daily limit.

  • before this line:

    return mail($to, $subject, $body, $headers_string);

    log the parameters so you can see what's happening

    error_log(print_r($to,1)); error_log(print_r($subject,1)); error_log(print_r($body,1)); error_log(print_r($headers_string,1));

    Then attempt a registration and watch your error log to see what exactly is being passed into the mail function

  • Ok I added the lines and cleared the log so it would be fresh. There is a lot of text there. The only thing that kind of jumps out at me is the email address: hnphockeylondon@weconnectat.ca which is what I set for sending emails which is different than admin's email address. That I know of that is allowed otherwise they wouldn't have a separate area for it.

    I did test the email address hnphockeylondon@weconnectat.ca and it works.

    Here is what is in the log if you can see where the problem is. It does have a url variable at the end, could that be what is wrong? Like I said, it expects elgg to be in the root or /elgg.

    [Wed Mar 04 13:20:05 2015] [5928640] [fcgid:warn] [client 99.249.38.154:59355] mod_fcgid: stderr: datadan@rogers.com, referer http://weconnectat.ca/hnphockeylondon/register
    [Wed Mar 04 13:20:05 2015] [5928640] [fcgid:warn] [client 99.249.38.154:59355] mod_fcgid: stderr: datadan please confirm your email address for Huff N Puff Hockey London, referer http://weconnectat.ca/hnphockeylondon/register
    [Wed Mar 04 13:20:05 2015] [5928640] [fcgid:warn] [client 99.249.38.154:59355] mod_fcgid: stderr:  Community!, referer http://weconnectat.ca/hnphockeylondon/register
    [Wed Mar 04 13:20:05 2015] [5928640] [fcgid:warn] [client 99.249.38.154:59355] mod_fcgid: stderr: datadan,, referer http://weconnectat.ca/hnphockeylondon/register
    [Wed Mar 04 13:20:05 2015] [5928640] [fcgid:warn] [client 99.249.38.154:59355] mod_fcgid: stderr: Before you can start you using Huff N Puff Hockey London Community, you, referer http://weconnectat.ca/hnphockeylondon/register
    [Wed Mar 04 13:20:05 2015] [5928640] [fcgid:warn] [client 99.249.38.154:59355] mod_fcgid: stderr: must confirm your email address., referer http://weconnectat.ca/hnphockeylondon/register
    [Wed Mar 04 13:20:05 2015] [5928640] [fcgid:warn] [client 99.249.38.154:59355] mod_fcgid: stderr: Please confirm your email address by clicking on the link below:, referer http://weconnectat.ca/hnphockeylondon/register
    [Wed Mar 04 13:20:05 2015] [5928640] [fcgid:warn] [client 99.249.38.154:59355] mod_fcgid: stderr: http://weconnectat.ca/hnphockeylondon/uservalidationbyemail/confirm?u=52&c=77663c0a200009afd4a5c5167ac78654, referer http://weconnectat.ca/hnphockeylondon/register
    [Wed Mar 04 13:20:05 2015] [5928640] [fcgid:warn] [client 99.249.38.154:59355] mod_fcgid: stderr: If you can't click on the link, copy and paste it to your browser manually., referer http://weconnectat.ca/hnphockeylondon/register
    [Wed Mar 04 13:20:05 2015] [5928640] [fcgid:warn] [client 99.249.38.154:59355] mod_fcgid: stderr: Huff N Puff Hockey London Community, referer http://weconnectat.ca/hnphockeylondon/register
    [Wed Mar 04 13:20:05 2015] [5928640] [fcgid:warn] [client 99.249.38.154:59355] mod_fcgid: stderr: http://weconnectat.ca/hnphockeylondon/, referer http://weconnectat.ca/hnphockeylondon/register
    [Wed Mar 04 13:20:05 2015] [5928640] [fcgid:warn] [client 99.249.38.154:59355] mod_fcgid: stderr: Content-Type: text/plain; charset=UTF-8; format=flowed, referer http://weconnectat.ca/hnphockeylondon/register
    [Wed Mar 04 13:20:05 2015] [5928640] [fcgid:warn] [client 99.249.38.154:59355] mod_fcgid: stderr: MIME-Version: 1.0, referer http://weconnectat.ca/hnphockeylondon/register
    [Wed Mar 04 13:20:05 2015] [5928640] [fcgid:warn] [client 99.249.38.154:59355] mod_fcgid: stderr: Content-Transfer-Encoding: 8bit, referer http://weconnectat.ca/hnphockeylondon/register
    [Wed Mar 04 13:20:05 2015] [5928640] [fcgid:warn] [client 99.249.38.154:59355] mod_fcgid: stderr: From: hnphockeylondon@weconnectat.ca, referer http://weconnectat.ca/hnphockeylondon/register
    [Wed Mar 04 13:20:05 2015] [5928640] [fcgid:warn] [client 99.249.38.154:59355] mod_fcgid: stderr: PHP WARNING: 2015-03-04 15:20:05 (EST): "mail() [<a href='function.mail'>function.mail</a>]: Bad parameters to mail() function, mail not sent." in file /home/content/40/5928640/html/hostedsites/weconnectat.ca/hnphockeylondon/engine/lib/notification.php (line 685), referer http://weconnectat.ca/hnphockeylondon/register

     

  • It looks like there may be a line break in the subject between 

    datadan please confirm your email address for Huff N Puff Hockey London

    and

    community!


    I'm not sure if that would cause mail to fail, I've never tried sending an email with line breaks in the subject before... if that's the issue that also explains why it didn't happen on your other instances
     

  • Matt, I think you are on to something, I tried a new installation with the folder name of vgc after vanluykgarden had the same problem and the validation email works with vgc.

    Ok, if that is the cause, then that problem would continue to exist in 1.10 if nothing has been changed from the 1.9 version. It's easy enough to test, create a quick install of 1.10.2 in a folder with a longer name and as soon as you get it installed register as a new user.

    Unfortunately I'm running php 5.3 and 1.10 requires php 5.4 or I would test that theory.

  • Well the short folder name doesn't appear to be it. I just created one called hnp and I still have the same problem. It's almost like one time you extract the zip file and it works and the next time it corrupts a file or something and doesn't.

    I have two more short folder names I'm going to try /demo and /vgc and see what happens.