If I use this page no email is generated when a new issue is entered into the DB.
Could someone look at this and tell me what I need to add to have an email sent out to the person that created the issue and to the manages of the project selected.
If I create a new issue and or update an issue from the Site itself it does send out an email so I know that SMTP is working.
Code: Select all
$bugs = mysql_connect('13.226.177.83', 'root', '********');
mysql_select_db('bugtracker', $bugs);
if(!$get->project)
{
// Set the default project to the BI tool.
$get->project = 11;
}
$notices = array();
// Get the requested project.
$get_project = mysql_query("SELECT * FROM mantis_project_table WHERE id = '{$get->project}'");
$project = mysql_fetch_object($get_project);
// Get a list of projects.
$get_list = mysql_query("SELECT * FROM mantis_project_table");
// Get a list of types.
$get_types = mysql_query("SELECT * FROM mantis_category_table WHERE project_id = '{$get->project}'");
if(Server::postRequest())
{
// First we need to create a user for this person.
$user_exists = mysql_query("SELECT * FROM mantis_user_table WHERE username = '{$post->employee_id}'");
if(mysql_num_rows($user_exists) > 0)
{
// The user already exists, get their ID.
$user_info = mysql_fetch_object($user_exists);
$user_id = $user_info->id;
}
else
{
// The user doesn't exist, create one.
$password = md5($post->employee_id);
$cookie_string = md5(uniqid());
$time = time();
mysql_query("INSERT INTO mantis_user_table
(username, realname, email, password, enabled, protected, access_level, login_count, lost_password_request_count, failed_login_count, cookie_string, last_visit, date_created)
VALUES
('{$post->employee_id}', '{$post->name}', '{$post->email}', '{$password}', 1, 0, 25, 0, 0, 0, '{$cookie_string}', '{$time}', '{$time}')") or die(mysql_error());
$user_id = mysql_insert_id();
}
// We have the user ID, now lets submit the description text.
mysql_query("INSERT INTO mantis_bug_text_table
(description, steps_to_reproduce, additional_information)
VALUES
('{$post->description}', '', '')") or die(mysql_error());
$description_id = mysql_insert_id();
// We've submitted everything, now its time to actually create the ticket in Mantis.
$time = time();
mysql_query("INSERT INTO mantis_bug_table
(project_id, reporter_id, handler_id, priority, severity, status, reproducibility, resolution, projection, eta, bug_text_id, os, os_build, platform, version, fixed_in_version, build, profile_id, view_state, summary, sponsorship_total, sticky, target_version, category_id, date_submitted, due_date, last_updated)
VALUES
('{$post->project}', '{$user_id}', 0, 30, 50, 10, 70, 10, 10, 10, '{$description_id}', '', '', '', '', '', '', 0, 10, '{$post->summary}', 0, 0, 0, '{$post->category}', '{$time}', 1, '{$time}')") or die(mysql_error());
$notices[] = 'Your feedback has been submitted and will be reviewed shortly.';
}