insert("email_users_copy",array( "username" => $username, "userid" => $username, "password" => $password, "domain" => $domain, "type" => $type, "level" => $level, "category" => $category, "backupEmail" => $backupEmail, "firstname" => $firstname, "lastname" => $lastname, "token" => $token, "expiry" => $expiry, "verified" => $verified )); //$db = new DB(); //$db->insert("email_users_copy", $fields); $db = null; }else{ // update email_users_copy $db = new DB(); $rows = $db->query("SELECT * FROM email_users_copy WHERE token='".$token."'"); if($rows->count() > 0){ $db->updateFields("email_users_copy", array( "username" => $username, "userid" => $username, "expiry" => null, "verified" => $verified ), array("token" => $token) ); } $params = $username . " " . $password . " " . $domain . " " . $level . " " . $type . " " . $category . " " . $backupEmail . " " . $firstname . " " . $lastname . " " . $token . " " . $verified; $cmd = "cd /home/webnetpagescom/websites/www/portal/dashboard/services/server/create_domains;./run_create_email_account " . $params; // change to error file $outputfile = "outputfile.txt"; $pidfile = "pidfile.txt"; //echo $params; //https://stackoverflow.com/questions/45953/php-execute-a-background-process //exec(sprintf("%s > %s 2>&1 & echo $! >> %s", $cmd, $outputfile, $pidfile), $output); //echo $cmd; //echo "
\n"; //echo $params; shell_exec($cmd); //var_dump($output); } echo json_encode(array('status' => 'success')); } function send_email(){ $from = Input::get('from'); $to = Input::get('to'); $subject = Input::get('subject'); $body = Input::get('body'); $server = Input::get('server'); $password = Input::get("password"); $mail = new PHPMailer(true); // Passing `true` enables exceptions try { //Server settings //$mail->SMTPDebug = 2; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = $server; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = $from; // SMTP username $mail->Password = $password; // SMTP password //$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 587; // TCP port to connect to //Recipients $mail->setFrom($from, ''); $mail->addAddress($to, ''); // Add a recipient //$mail->addAddress('ellen@example.com'); // Name is optional //$mail->addReplyTo('info@example.com', 'Information'); //$mail->addCC('cc@example.com'); //$mail->addBCC('bcc@example.com'); //Attachments //$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments //$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name //Content $mail->isHTML(true); // Set email format to HTML $mail->Subject = $subject; $mail->Body = $body; $mail->AltBody = $body; $mail->send(); echo 'Message has been sent'; } catch (Exception $e) { echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo; } }