HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Welcome Email

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#54540 (In Topic #11891)
Avatar

Fan in action

Can't create one

When I try to create a Welcome Email, I don't receive an outright error, but when go to edit the email, it tells me in the list of available emails:

[This entry failed to be properly created; please edit/delete as appropriate]

I can delete the entry, and I can try editting it. However, nothing seems to change it's status. And, of course this email cannot be sent out when new users join.

I have my cron setup, and it appears to be running without issue.

I created the most simplistic of emails with "test" as the name of the email, the subject, and the content, and I have it set to send after 1 hour of a new member joining.

Ideas, suggestions?

Thanks in advance for your assist.

Steve
Back to the top
 
Posted
Rating:
#54603
Avatar

Honoured member

I just tried to recreate your scenario but it's working fine for me.

What version of ocp are you using?

Have you tried Website cleanup tools? to clear caches

I'll report back in an hour to see if the email was sent successfully.
Back to the top
 
Posted
Rating:
#54605
Avatar

Fan in action

I'm on 4.1.13.

I'm my list of available Welcome emails, I don't have any defaults or preexisting versions. When I try to create one, it seems that ocPortal doesn't fully process it as a new item. After I create it and look in my Welcome email list, it shows "[This entry failed to be properly created; please edit/delete as appropriate]". I can go in and try editting the email I created, but it never changes the status of my creation, and the email is never able to be sent out.

As far as sending out emails, I've verified that ocPortal is able to send out other types of email messages, such as warnings, internal emails, etc.

Thanks,

Steve
Back to the top
 
Posted
Rating:
#54608
Avatar

Honoured member

My cron wasn't setup   :$

so I'm waiting for the hour to pass so that I can confirm the welcome mail sending or not.

Will let you know.

Curious did you do a manual install?  Are you on a live host or on a dev env with something like wamp?

Back to the top
 
Posted
Rating:
#54610
Avatar

Honoured member

I can confirm I get the exact same error as you.

I can create the welcome emails just fine but once I go to edit them  I see

[This entry failed to be properly created; please edit/delete as appropriate]

However, once I click on that message it does show me my welcome email below.

I'm waiting for the hour to lapse to see if it actually sends it.

I'll dig around the logs and stuff to see if I can glean anything valuable for the ocP folks.

Back to the top
 
Posted
Rating:
#54629
Avatar

Honoured member

The Welcome emails don't work. They never went out. Other email notifications work just fine.

Even 4.2 rc3 welcome mails don't go out. I don't know why…

ocPortal Admins- please help.

TIA.
Back to the top
 
Posted
Rating:
#54644
Avatar

Do these files fix the problem?

Attachment
sources/hooks/systems/cron/ocf_welcome_emails.php
» Download: ocf_welcome_emails.php (1.99 Kb, 254 downloads so far)
Attachment
adminzone/pages/modules/admin_ocf_welcome_emails.php
» Download: admin_ocf_welcome_emails.php (7 Kb, 242 downloads so far)


Also make sure that:
  • the user has been signed up long enough to receive the welcome email for the time you specified
  • the user has not been signed up too long such that the time when they would have got the welcome email you have now set up has passed
  • the user is set to "Allow e-mails"
  • the user has an email address defined


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#54650
Avatar

Honoured member

Are these files for 4.2 rc3 or 4.1.13 or both?

Chris Graham said

  • the user has been signed up long enough to receive the welcome email for the time you specified
  • the user has not been signed up too long such that the time when they would have got the welcome email you have now set up has passed
  • the user is set to "Allow e-mails"
  • the user has an email address defined
signed up long enough? as in I create a new account with a valid email and then just wait an hour to get the email without actually logging in to the site? Or the user has to be logged in for an hour to receive the welcome?

don't understand the second one? the user is signed up to long, so that the time has passed? confused O_o

User set to allowed emails - Yes :thumbs:

User has an email address defined - as in something@something.com ? Then yes :thumbs:
I don't use "real" addresses since I have a little proggy capturing all port 25 traffic on my local box where I can see the email etc.


One more question - Setting the hours to zero, does that make the welcome letter go out immediately?


Last edit: by ocPortal_Noob
Back to the top
 
Posted
Rating:
#54651
Avatar

Honoured member

Thx Chris!  :thumbs:

That fixes things on 4.1.13  everything is working as expected.

Should I use this for 4.2 rc3?
Back to the top
 
Posted
Rating:
#54653
Avatar

Honoured member

Oops   :$   er uhm  never mind on 4.2 RC3

all is well…

over and out

*squack*
Back to the top
 
Posted
Rating:
#54656
Avatar

I did the fixes on 4.1 but the code in 4.2 is likely the same so it'll work. The next 4.2 (4.2 final) will have the fixes (actually one of the bugs was already fixed).

don't understand the second one? the user is signed up to long, so that the time has passed? confused O_o

If you put in a welcome email to be sent 1 hour after joining, then it'll never go out to people who have already been a member more than 1 hour.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#54706
Avatar

Fan in action

Thanks Chris.  Part of the problem is solved.  I am able to see my welcome messages now in th editting list.  However, the welcome message is not being sent.  I use a Windows 2003 server with Apache2.2+php5.3.  I've created my php statement to run the cron_bridge in my scheduled tasks, and that tasks is running without error every 10 mins.  My statement looks like this:
c:\php\php.exe -C -q –no-header "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\portal\data\cron_bridge.php"

Is that correct?  I did a c:\php\php.exe –help  to see what those params mean, and the help does not list -C or -q as a parameter.  I'm not sure if that's related or not.  I'm no php expert by a long shot.  Do you know how I can confirm my statement is working correctly?

Thanks.

Steve
Back to the top
 
Posted
Rating:
#54709
Avatar

The 'C' and 'q' will be there for different PHP versions/executable-types, if you see no errors it should be running correctly. Did you check the 4 things I mentioned in my post with the fixes?

If you check the 'values' table you should see one with a name of 'last_welcome_mail_time'. This holds a timestamp of when the welcome mail code last ran.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#54724
Avatar

Fan in action

Hi Chris,
Yes, I followed your 4 points above.  I've also verified that the unix timestamp in the values table is updating.  So, it seems the cron_bridge is working.  I've verified my php mail handler is working via a simple php script.  I'm not spotting any errors in the apache error log.  Is there a more direct way to call the script/file in OCP to test if it will email?  This is odd that I can send email directly to users on-demand, but this welcome email will not go out.

BTW, I've enjoyed working on these little issues.  It's knocking the rust off of my web hosting abilities that I havent used in a few years.

More ideas?

Thanks,

Steve
Back to the top
 
Posted
Rating:
#54727
Avatar

You're not sending out on newsletter by mistake? (that's an option on the welcome mail form)

You can check the logged_mail_messages table to see if anything went in there (this should log all emails sent).

You could try changing line 60 of the ocf_welcome_emails.php file to:

Code

            exit('SELECT m_email_address,m_username FROM '.get_table_prefix().'f_members'.$where);
Then calling up cron_bridge.php manually, and seeing what it says. Then working out why that query is not working (assuming that is the cause).


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#54728
Avatar

Fan in action

Hi Chris,

I changed ocf_welcome_emails.php from:

Code


$where=' WHERE m_join_time<'.strval($time+$seconds_after_joining).' AND m_join_time>'.strval($last_time+$seconds_after_joining).' AND m_allow_emails=1';
$members=$GLOBALS['FORUM_DB']->query('SELECT m_email_address,m_username FROM '.get_table_prefix().'f_members'.$where);
}


Added in your code on line 60:

Code


$where=' WHERE m_join_time<'.strval($time+$seconds_after_joining).' AND m_join_time>'.strval($last_time+$seconds_after_joining).' AND m_allow_emails=1';
$members=$GLOBALS['FORUM_DB']->query('SELECT m_email_address,m_username FROM '.get_table_prefix().'f_members'.$where);
exit('SELECT m_email_address,m_username FROM '.get_table_prefix().'f_members'.$where);
}


Line 60 is actually where the closing } is located, so I added the code right above it.

I wasn't sure if by running cron_bridge.php manually you meant to run it from a browser, or run the script through a command line statement, so I did both.

Running through a browser produces an OCP error page saying:

An error has occurred

PHP NOTICE [8] Undefined variable: i100 (version: 4.1.13, PHP version: 5.3.0, URL: /portal/data/cron_bridge.php)

Here is the stack trace:

Members of staff will see a 'stack trace' here.



When i run this through a command line, I see a whole bunch of scripting pouring out to the command window. Too much scripting to display here.
Back to the top
 
Posted
Rating:
#54729
Avatar

Could you redirect that output to a file and send me the file please (chris@ocportal.com).

c:\php\php.exe -C -q -no-header "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\portal\data\cron_bridge.php" > output_for_chris


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#54732
Avatar

Honoured member

Hey there fellas,

I was using   php-cgi.exe   instead of php.exe

That is what was working for me on windows platform.

Hope that helps.
Back to the top
 
Posted
Rating:
#54738
Avatar

Fan in action

Chris,
I discovered something new.  I didn't realize there was an ocPortal error log.  I had just been looking in the Apache error log.  Anyway, here's the error I'm seeing related to my crons.

A configuration option (<tt>allow_email_disable</tt>) which does not exist was referenced (version: 4.1.13, PHP version: 5.3.0, URL: \data\cron_bridge.php)

What does this mean, and what do I do about it?

Thanks for your help as always.
Back to the top
 
Posted
Rating:
#54770
Avatar

This is my fault, I sent you the 4.2.x version of the file by mistake. Last week I was feeling pretty ill and I think my support suffered as a result ;).  The "fix" I made to the ocf_welcome_emails.php file high up in this topic was bogus and not needed and actually broke things; the original file is tested and works.

So let's start again :).

Attached is the file for 4.1.x. It actually has nothing (*1) fixed over the original, but the code is easier to read.
Attachment
» Download: ocf_welcome_emails.php (2 Kb, 232 downloads so far)


I just tested as follows:
  • Created a new welcome mail, default settings except I typed in text to the required fields
  • I logged out
  • I joined as a test user
  • I waited a few seconds to make it a fair test
  • I then called up the cron_bridge.php script manually by URL (just because I don't have CRON set up on my test server)
  • I checked the logged_mail_messages table and the email to test was in there. That's better than checking e-mail accounts, as you can be confident anything in that table has been sent (and it's instant, so no waiting around for mails to arrive).

I have also put something in this file for debugging. You can change "if (false)" to "if (true)" and it'll output the query it ran and it's results. If you get results all that could stop the mail going out is if your member account had no email address.

It is crucial that your test user has joined after you have added the welcome mail. Welcome mails are not sent retroactively for existing users.

*1 - Actually there is one minor bug fix. If the CRON script ran at the precise second that the member had joined I think the welcome mail would have not gone out. I don't think this was your problem though.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Expand