close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Email not sending ... trigger issue?

Thread began 12/07/2019 10:08 am by sandy170299 | Last modified 12/10/2019 10:07 pm by Ray Borduin | 495 views | 27 replies |

sandy170299

Email not sending ... trigger issue?

This process updates 2 separate records in the users table, inserts a transaction into the transactions table, grabs the last transaction entered into the transaction table, and emails the users involved with that transaction details. The problem is, the email is not sending.

Can you see why this is not working? Does it have something to do with the trigger, Successful update? How can I get this email to be sent the very last thing, after the update and insert scripts run? Ignore all of the testing echo code output, FYI. Code is attached.

Also, it's not redirecting, probably because the email isn't being sent???

Thank you.

Sign in to reply to this post

Ray BorduinWebAssist

It looks like the email is using a trigger from a security rule "Successful update"... I'd have to look at the helper_groups_rules.php file to see that that rule means to see if that is the issue. It is likely that either the conditions of the rule aren't being met, or the getRecipient recordset has no results, or there could be an issue in the email body.

Sign in to reply to this post
Did this help? Tips are appreciated...

sandy170299

Please see code below:

<?php

function WA_Auth_GetComparisonsForRule($ruleName){
$comparisons = array();

switch ($ruleName){
case "Bad return url from encryption email":
$comparisons[0] = array(TRUE, "".((isset($_GET['badURL']))?$_GET['badURL']:"") ."", 2, "");
break;
case "Email address not found":
$comparisons[0] = array(TRUE, "".((isset($_GET['notFound']))?$_GET['notFound']:"") ."", 2, "");
break;
case "Email server failure":
$comparisons[0] = array(TRUE, "".((isset($_GET['EmailFail']))?$_GET['EmailFail']:"") ."", 2, "");
break;
case "Emailed password":
$comparisons[0] = array(TRUE, "".((isset($_GET['emailedPassword']))?$_GET['emailedPassword']:"") ."", 2, "");
break;
case "Encrypted email return set":
$comparisons[0] = array(TRUE, "".((isset($_SESSION["WAENCRYPTEDRETURNUSED"]) && $_SESSION["WAENCRYPTEDRETURNUSED"])?"1":"") ."", 2, "");
break;
case "Encrypted email return success":
$comparisons[0] = array(TRUE, "".((isset($_SESSION["WAENCRYPTEDRETURNSUCCESS"]) && $_SESSION["WAENCRYPTEDRETURNSUCCESS"])?"1":"") ."", 2, "");
break;
case "Failed log in":
$comparisons[0] = array(TRUE, "".((isset($_GET['failedLogin']))?$_GET['failedLogin']:"") ."", 2, "");
break;
case "Log in success":
$comparisons[0] = array(TRUE, "".((isset($_GET['loggedIn']))?$_GET['loggedIn']:"") ."", 2, "");
break;
case "Logged in to adminuser":
$comparisons[0] = array(TRUE, "".((isset($_SESSION['SecurityAssist_userid']))?$_SESSION['SecurityAssist_userid']:"") ."", 2, "");
break;
case "Logged in to pcms2_users":
$comparisons[0] = array(TRUE, "".((isset($_SESSION['SecurityAssist_UserID']))?$_SESSION['SecurityAssist_UserID']:"") ."", 2, "");
break;
case "Logged in to users":
$comparisons[0] = array(TRUE, "".((isset($_SESSION['SecurityAssist_user_id']))?$_SESSION['SecurityAssist_user_id']:"") ."", 2, "");
break;
case "Successful forgot password update":
$comparisons[0] = array(TRUE, "".((isset($_GET['fpsuccess']))?$_GET['fpsuccess']:"") ."", 2, "");
break;
case "Successful update":
$comparisons[0] = array(TRUE, "".((isset($_GET['success']))?$_GET['success']:"") ."", 2, "");
break;
case "Validated form":
$comparisons[0] = array(TRUE, "".((isset($_GET['invalid']))?$_GET['invalid']:"") ."", 2, "");
break;
}
return $comparisons;
}


function WA_Auth_GetGroup($groupName){
$group = Array();

switch($groupName){

}

return $group;
}

?>

Sign in to reply to this post

sandy170299

I know it's inserting and I know it's updating because I can see the calculations changing on screen, on the transferaction.php page. Additions and subtractions. The only snag is it is NOT sending the email, which is where the redirect is. All 4 of the processes, 2 updates, 1 insert, and 1 email, are all now using the trigger "before page load." Maybe they shouldn't be? I will attach the page again in a zip file.

Sign in to reply to this post

Ray BorduinWebAssist

Use the same trigger as the insert or update. The "Successful update" rule checks for a success url parameter which is designed for the page after the redirect if you append that parameter to the url. It is used to show a success message on the next page after an update.

Sign in to reply to this post
Did this help? Tips are appreciated...

sandy170299

Not sure I'm clear on this. All of them have the "before page load" option for the trigger at this time. Are you saying that i should use the Successful Update trigger for the email piece? Sorry - I just want to be clear.

Sign in to reply to this post

Ray BorduinWebAssist

No. I'm saying that trigger is designed for a success page after an update not for the same page as the update. If you want to send an email after an update then it should be on the same page and use the same trigger as the update. They should probably both be using a button press trigger if you want it to update based on a form submit.

Sign in to reply to this post
Did this help? Tips are appreciated...

sandy170299

All four processes ARE on the same page. I tried to put them in order. Updating the 2 tables first, then the insert script, then the email, which gets the last_id from the inserted recordset. Here's how the process works. The form is submitted on one page. It goes to a 2nd page, where it shows you what you have listed on the first page and asks you to confirm it. The third page of the process is actually where the udpating, inserting, and email takes place.

Should I eliminate the confirmation page and put all of the scripts on the page after the form is submitted? Or should I have the scripts run on the same page AFTER the submit button has been pressed?

I hope this makes sense to you.

Thanks.

Sign in to reply to this post

Ray BorduinWebAssist

I'm not sure what you are doing, but usually I put all of the actions on the same page, using the same trigger, which is the form button press event, and then redirect in the last one to the success page which does nothing other than display a message. It is more of a matter of preference than anything, but I find that easier for organizational purposes.

Sign in to reply to this post
Did this help? Tips are appreciated...

sandy170299

I have moved all of the code to the ledger.php page, which is included in index.php. Now, it's not updating, inserting, or sending an email. FYI, I am receiving NO errors.

Yep ... I'm stumped! :/ Thank you!

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...