Jump to content

Send Email alert to user


dapcigar

Recommended Posts

Am trying to get an email address from the DB and send an alert but it's not working.. :facepalm:

 

$search3 = mysql_query("SELECT email FROM users WHERE department = '$department' AND (position = '$position')") or die(mysql_error());
    $acct1 = mysql_fetch_array($search3);
    
    $email = $acct1['email'];

$to      = $email;
$subject = 'New Requisition Alert';
$message = 'You have a new message';
$headers = 'From: [email protected]' . "\r\n" .
    'Reply-To: [email protected]' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);

Link to comment
https://forums.phpfreaks.com/topic/288509-send-email-alert-to-user/
Share on other sites

It might help if you provide a little more information. What do you mean by "it's not working"? Are you getting errors? If so, what are they?

 

What have you tried to debug the issue? For example, have you checked if the database query returned anything?

 

Have you enabled errors? Note that you can add the following snippet to the top of your script to show all PHP errors and warnings:

 

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.