Jump to content

kwollaston

New Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by kwollaston

  1. I can't find a way to edit my post, but would this work for you? private _addresses; public function insert_NewsCast($topic, $content) { $query = $this->db->prepare("INSERT INTO `news` (`topic`, `content`, `date`) VALUES (?, ?, NOW())"); $query->bindValue(1, $topic); $query->bindValue(2, $content); try { $query->execute(); $query = $this->db->prepare('SELECT `address` from `emails`'); try { $query->execute(); $result = $query->fetchAll(); foreach($result as $row) { $addresses = (empty($addresses)) ? $row['email'] : $addresses .= ', ' . $row['address']; } } catch (PDOException $e) { die($e->getMessage()); } $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $message = '<html>' . '<head>' . ' <title>Notification from test site</title>' . '</head>' . '<body>' . ' <p>New post up on the Website!</p>' . ' <a href = "http://www.test.co.za">Take a look</a>' . ' <p>Regards,<br />The Team!</p>' . '</body>' . '</html>'; mail($addresses, $topic, $message, $headers); } }
  2. I don't quite understand. Are there users in your table with email addresses or is there just a separate mailing list table that contains emails? If so, what you want would be to store the user id in the subscription table if the user is subscribed. If there are multiple mailing lists also store the list id in the subscription table. Then you would just mail the list right there in your insert function. I feel like I need to see a little more code, if there is any. Edit: Mainly, what I need to know is how email addresses are stored.
×
×
  • 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.