Sc_send_notification() in app with direct url

I have a Blank application that can be executed directly via a URL, without requiring login. Within the code, I use the macro sc_send_notification(). While the notification is sent successfully, the email is not delivered.

In other applications where the user is logged in, the email sends correctly to the same test user.

I suspect the issue lies in the absence of global variables when accessing without a session, such as [sett_smtp], which I tried defining manually, but the email still isn’t sent.

Does anyone know what other variables might be necessary or how to resolve this? Thank you!

$check_sql = "SELECT set_name, set_value FROM sec_settings";
sc_lookup(rs, $check_sql);
if (isset({rs[0][0]}))     // Row found
{
    foreach({rs} as $f ){
        $_SESSION[ 'sett_'. $f[0] ] = $f[1];
    }
}

if($_SESSION[ 'sett_smtp_api'] == 'custom'){
	$_SESSION[ 'sett_smtp' ] = array(
		'settings' => array(
		'gateway' => 'smtp',
		'smtp_server' => $_SESSION[ 'sett_smtp_server'],
		'smtp_protocol' => $_SESSION[ 'sett_smtp_security'],
		'smtp_port' => $_SESSION[ 'sett_smtp_port'],
		'smtp_user' => $_SESSION[ 'sett_smtp_user'],
		'smtp_password' => $_SESSION[ 'sett_smtp_pass'],
		'from_email' => $_SESSION[ 'sett_smtp_from_email'],
		'from_name' => $_SESSION[ 'sett_smtp_from_name'],
		)
	);
}else{
	$_SESSION[ 'sett_smtp'] = array('profile' => $_SESSION['sett_smtp_api']);
}