Jump to content

[SOLVED] Problem with Cron PHP Mailer


mattclements

Recommended Posts

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
Share on other sites

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 support@foo.com3Message was not sent
Mailer Error: SMTP Error: Could not authenticate
Please report this to support@foo.com3Message was not sent
Mailer Error: SMTP Error: Could not authenticate
Please report this to support@foo.comDEMO DONE.

 

:facewall:

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.