mattclements Posted August 3, 2009 Share Posted August 3, 2009 Hey all, Right - I have an old server that used to look through a PostgreSQL table called demo users and send out their usernames & passwords if the column "processed" is 0 (then change it too 1). This worked on the old server - however somebody transfered this to a new server a while back and didnt setup the cron job. I have just looked at the script - but can't work out why its not sending the mails. I have found out that when running the script using echo commands to find out how far the script runs - it displays the first echo, but not the second. <? include( "cron_root.php" ); ?> <? //echo "Up to Step 1"; // 1. get email address(s) $proc_demos_q = m_execute_query_full( "XXXX", " select * from demo_users where processed = '0' LIMIT 1 " ); if ( isset( $proc_demos_q ) && ( sizeof( $proc_demos_q ) > 0 ) ) { for( $idx=0; $idx<sizeof( $proc_demos_q ); $idx++ ) { $current_demo_id = $proc_demos_q[$idx][ "uuid_demo_users" ]; $current_email = $proc_demos_q[$idx][ "email" ]; $uuid_partner = $proc_demos_q[$idx][ "uuid_partner" ]; $confirm_email = $proc_demos_q[$idx][ "confirm_email" ]; $confirm_subject = $proc_demos_q[$idx][ "confirm_subject" ]; // 1. create demo application account $acc_params = array(); $acc_params[ "email" ] = $current_email; $acc_params[ "uuid_partner" ] = $uuid_partner; $acc_params[ "current_demo_id" ] = $current_demo_id; $acc_create_r = m_demo_create( $acc_params ); if ( $acc_create_r[ "result" ] == '1' ) { // get partner id email $get_part_q = m_execute_query_full( "XXXX", " select * from partners where uuid_partner = '$uuid_partner' " ); if ( isset( $get_part_q ) && ( sizeof( $get_part_q ) > 0 ) ) { //echo "Up to Step 1"; // 2. send email with details og login. $email[ "from_address" ] = $get_part_q[0][ "partner_email" ]; $email[ "to_address" ] = $current_email; if ( trim( $confirm_subject ) == '' ) { $email[ "subject" ] = "XXXX - Demonstration Account"; } else { $email[ "subject" ] = $confirm_subject; } $email[ "mess_type" ] = "HTML"; // 3. form the message if ( m_url_check( $confirm_email ) ) { $params[ "get_url" ] = $confirm_email; } else { $params[ "get_url" ] = "http://XXXX/demo_email.htm"; } $content = m_get_web_page( $params ); $replace_tok[ "content" ] = $content; $gen_password = $acc_create_r[ "password" ]; $replace_tok[ "name_tokens" ] = array( "{current_email}" => $current_email, "{gen_password}" => $gen_password ); $content = m_replace_tokens( $replace_tok ); $email[ "message" ] = $content; // 4. now send the message m_email( $email ); $organ_name = $get_part_q[0][ "organ_name" ]; // 5. send another copy to development $email[ "to_address" ] = "USER@XXXX"; $email[ "subject" ] = $email[ "subject" ]." (COPY) - ".$organ_name; m_email( $email ); // 6. send another copy to USER@XXXX $email[ "to_address" ] = "USER@XXXX"; $email[ "subject" ] = $email[ "subject" ]." (COPY) - ".$organ_name; m_email( $email ); echo 'DEMO DONE.'; } } } } ?> Any help appriciated. Matt Link to comment https://forums.phpfreaks.com/topic/168721-solved-problem-with-cron-php-mailer/ Share on other sites More sharing options...
abazoskib Posted August 4, 2009 Share Posted August 4, 2009 can you post that with better formatting? too much whitespace Link to comment https://forums.phpfreaks.com/topic/168721-solved-problem-with-cron-php-mailer/#findComment-890185 Share on other sites More sharing options...
ldougherty Posted August 4, 2009 Share Posted August 4, 2009 Where exactly does it fail, not sure which echo statement you were referring to. You should try echoing the value of the variables before they are called upon in if statements to determine if they have the value anticipated. Link to comment https://forums.phpfreaks.com/topic/168721-solved-problem-with-cron-php-mailer/#findComment-890188 Share on other sites More sharing options...
mattclements Posted August 4, 2009 Author Share Posted August 4, 2009 Ok - Some how with some flicking through I found the script to stop & fail where building the array. However I made a few minor adjustments and the error seems to have been fixed. I now have a server side issue (i belive) as this script has never been on this server. 3Message was not sent Mailer Error: SMTP Error: Could not authenticate Please report this to [email protected] was not sent Mailer Error: SMTP Error: Could not authenticate Please report this to [email protected] was not sent Mailer Error: SMTP Error: Could not authenticate Please report this to [email protected] DONE. Link to comment https://forums.phpfreaks.com/topic/168721-solved-problem-with-cron-php-mailer/#findComment-890395 Share on other sites More sharing options...
trq Posted August 4, 2009 Share Posted August 4, 2009 Can we see m_email() ? Link to comment https://forums.phpfreaks.com/topic/168721-solved-problem-with-cron-php-mailer/#findComment-890396 Share on other sites More sharing options...
mattclements Posted August 4, 2009 Author Share Posted August 4, 2009 Thank you so much! I didn't look inside one of the API files (that happens to be called m_email.php) which sets the Authentication details to an external SMTP server (with Authentication) that the old server used to use. I am about to change and test. Thank you so much for your time & help. Matt Link to comment https://forums.phpfreaks.com/topic/168721-solved-problem-with-cron-php-mailer/#findComment-890535 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.