Jump to content

gideon107540

New Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by gideon107540

  1. <?php
    // Database connection
    $servername = "localhost";
    $username = "u880577714_enbullsnbears";
    $password = "Olagoro4";
    $dbname = "u880577714_enbullsnbears";

    try {
        $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
        $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

        // Retrieve email addresses
        $stmt = $conn->prepare("SELECT email FROM user");
        $stmt->execute();
        $emails = $stmt->fetchAll(PDO::FETCH_COLUMN);

        // Send emails
        
        $subject = $_POST['subject'];
        $message = $_POST['message'];
        $headers = "From: support@en.bullsnbearstraders.online";

        foreach ($emails as $email) {
            mail($email, $subject, $message, $headers);
            echo "Email sent to: $email<br>";
        }
    } catch(PDOException $e) {
        echo "Connection failed: " . $e->getMessage();
    }
    ?>

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.