Send an email to users of a select multiple after success in upload
Hello:
I have a form that uploads and writes to a database. The idea is that, from this form, documents are uploaded to share with one, some or all users, therefore, there is a multiple select and this works well. But, in addition, the idea is to send an email to the user or users with whom you want to share the document. And here my problems begin.
I thought about making a script that would pick up the emails of the user or the selected users in the select ... This is the script:
<?php
if(isset($_POST["us_alias"]) && $WA_DFP_UploadStatus["WA_UploadResult1"]["statusCode"] == 1) {
foreach($_POST["us_alias"] as $clave=>$valor){
$rsMail = new WA_MySQLi_RS("rsMail",$conexion_i,1);
$rsMail->setQuery("SELECT * FROM usuarios_pml WHERE usuarios_pml.us_nombre = ".GetSQLValueString($valor, "text"));
$rsMail->execute();
}
?>
I put this script just on the one corresponding to the WA mailing, which is the following:
<?php
if ($WA_DFP_UploadStatus["WA_UploadResult1"]["statusCode"] == 1) { //WA Universal Email
$Email = new WA_Email("Gestion_documentos");
$Email->From = "noreply@webpage.es";
$Email->CharSet = "UTF-8";
$Email->Method = "smtp";
$Email->Host = "smtp.webpage.es";
$Email->Port = "25";
$Email->SMTPAuth = true;
$Email->Username = "noreply@webpage.es";
$Email->Password = "XXXXXXXX";
$Email->addTo("".($rsMail->getColumnVal("us_mail")) ."");
$Email->BodyFile = "../webassist/email/templates/WebAssist-Block/Block.php";
if (function_exists("rel2abs") && $Email->Redirect) $Email->Redirect = $Email->Redirect?rel2abs($Email->Redirect,dirname(__FILE__)):"";
for ($emailGroup=0; $emailGroup<sizeof($Email->To); $emailGroup++) {
$Email->Subject = "XXXXXX le ha enviado un nuevo archivo";
$Email->send($emailGroup);
}
$Email->close();
}
?>
And what happens is that something causes a kind of collapse on the page because it stays blank in the browser, it shows no errors although I have
<? Php
error_reporting (E_ALL && ~ E_NOTICE);
?>
Does anyone have an idea of how to fix it?
Thank you