Good Sunday to all
I am increasingly satisfied with FLARUM and now I am studying the extensions ... I have a lot to learn
Life is strange: I graduated in Software Engineering in 1991 in Bologna (Italy) with 100/100 and Magna Laude
Then I followed the IT of some Financial Advisory Studies ... and I became a broker / trader myself
But the passion for programming remains, I started with Commodore and Sinclair
... back to us
Now I'm studying to prepare a well done extension and not a big mess, but for the moment I had to write an emergency php script to use immediately
I and my partners must send a simple link to a page with all the updates and instructions for each new version of our software package (more or less every week or two)
The link is always the same, we change the page at that address
So I put this simple script and I call it in my browser to mass mail
I hope it can help others and ... the extension for mass mails will come ... between a (nice) bit
Thx. Marco
<?php
# I put together
# https://www.w3schools.com/php/php_mysql_select.asp
# https://www.w3schools.com/php/func_mail_mail.asp
$servername = "localhost";
$dbname = "my-db-name";
$username = "my-user-name";
$password = "my-user-password";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Get users mail
$sql = "SELECT `email` FROM `f_users` WHERE 1";
$result = $conn->query($sql);
// Must have more than zero mails or something is wrong
if ($result->num_rows > 0) {
$msg = "Ciao" . "\r\n\r\n" . " Link Uzi aggiornato: https://blitz4x.com/public/uzi/uzi.html" . "\r\n\r\n" . "Se il CLICK non funziona, copia e incolla il link nel tuo browser" . "\r\n\r\n" . "https://blitz4x.com";
$headers = "Da uziforex@gmail.com";
// output data of each row
while($row = $result->fetch_assoc()) {
// send email
$success = mail($row["email"], "Uzi Forex Link", $msg, $headers);
if ($success) {
echo "mail to " . $row["email"] . " OK !" . "<br>";
} else {
$errorMessage = error_get_last()['message'];
echo "mail to " . $row["email"] . " ERROR " . $errorMessage . "<br>";
}
}
} else {
echo "0 results";
}
$conn->close();
?>