/**
 * Send bug info to given user
 * return true on success
 * @param array $p_visible_bug_data
 * @param string $p_message_id
 * @param int $p_project_id
 * @param int $p_user_id
 * @param array $p_header_optional_params
 * @return bool
 */
function email_bug_info_to_one_user($p_visible_bug_data, $p_message_id, $p_project_id, $p_user_id, $p_header_optional_params = null)
{
    $t_user_email = user_get_email($p_user_id);
    # check whether email should be sent
    # @@@ can be email field empty? if yes - then it should be handled here
    if (ON !== config_get('enable_email_notification') || is_blank($t_user_email)) {
        return true;
    }
    # build subject
    $t_subject = email_build_subject($p_visible_bug_data['email_bug']);
    # build message
    $t_message = lang_get_defaulted($p_message_id, null);
    if (is_array($p_header_optional_params)) {
        $t_message = vsprintf($t_message, $p_header_optional_params);
    }
    if ($t_message !== null && !is_blank($t_message)) {
        $t_message .= " \n";
    }
    $t_message .= email_format_bug_message($p_visible_bug_data);
    # build headers
    $t_bug_id = $p_visible_bug_data['email_bug'];
    $t_message_md5 = md5($t_bug_id . $p_visible_bug_data['email_date_submitted']);
    $t_mail_headers = array('keywords' => $p_visible_bug_data['set_category']);
    if ($p_message_id == 'email_notification_title_for_action_bug_submitted') {
        $t_mail_headers['Message-ID'] = $t_message_md5;
    } else {
        $t_mail_headers['In-Reply-To'] = $t_message_md5;
    }
    # send mail
    $t_ok = email_store($t_user_email, $t_subject, $t_message, $t_mail_headers);
    #LB/BFE: hook for plugin getting additional cc email for $p_user_id and sending email via email store
    $t_cc_ok = event_signal('EVENT_SEND_EMAIL_TO_CC_ADDRESS', array($p_user_id, $t_subject, $t_message, $t_mail_headers, $p_project_id));
    #$t_recipients_include_data = event_signal( 'EVENT_NOTIFY_USER_INCLUDE', array( $p_bug_id, $p_notify_type ) );
    return $t_ok;
}
Exemplo n.º 2
0
/**
 * Send bug info to given user
 * return true on success
 * @param array $p_visible_bug_data
 * @param string $p_message_id
 * @param int $p_project_id
 * @param int $p_user_id
 * @param array $p_header_optional_params
 * @return bool
 */
function email_bug_info_to_one_user($p_visible_bug_data, $p_message_id, $p_project_id, $p_user_id, $p_header_optional_params = null)
{
    $t_user_email = user_get_email($p_user_id);
    # check whether email should be sent
    # @@@ can be email field empty? if yes - then it should be handled here
    if (ON !== config_get('enable_email_notification') || is_blank($t_user_email)) {
        return true;
    }
    # build subject
    $t_subject = '[' . $p_visible_bug_data['email_project'] . ' ' . bug_format_id($p_visible_bug_data['email_bug']) . ']: ' . $p_visible_bug_data['email_summary'];
    # build message
    $t_message = lang_get_defaulted($p_message_id, null);
    if (is_array($p_header_optional_params)) {
        $t_message = vsprintf($t_message, $p_header_optional_params);
    }
    if ($t_message !== null && !is_blank($t_message)) {
        $t_message .= " \n";
    }
    $t_message .= email_format_bug_message($p_visible_bug_data);
    # build headers
    $t_bug_id = $p_visible_bug_data['email_bug'];
    $t_message_md5 = md5($t_bug_id . $p_visible_bug_data['email_date_submitted']);
    $t_mail_headers = array('keywords' => $p_visible_bug_data['set_category']);
    if ($p_message_id == 'email_notification_title_for_action_bug_submitted') {
        $t_mail_headers['Message-ID'] = $t_message_md5;
    } else {
        $t_mail_headers['In-Reply-To'] = $t_message_md5;
    }
    # send mail
    $t_ok = email_store($t_user_email, $t_subject, $t_message, $t_mail_headers);
    return $t_ok;
}
Exemplo n.º 3
0
function email_bug_info_to_one_user($p_visible_bug_data, $p_message_id, $p_project_id, $p_user_id, $p_header_optional_params = null)
{
    $t_user_email = user_get_email($p_user_id);
    # check whether email should be sent
    # @@@ can be email field empty? if yes - then it should be handled here
    if (ON !== config_get('enable_email_notification') || is_blank($t_user_email)) {
        return true;
    }
    # build subject
    $t_subject = '[' . $p_visible_bug_data['email_project'] . ' ' . bug_format_id($p_visible_bug_data['email_bug']) . ']: ' . $p_visible_bug_data['email_summary'];
    # build message
    $t_message = lang_get_defaulted($p_message_id, null);
    if (is_array($p_header_optional_params)) {
        $t_message = vsprintf($t_message, $p_header_optional_params);
    }
    if ($t_message !== null && !is_blank($t_message)) {
        $t_message .= " \n";
    }
    $t_message .= email_format_bug_message($p_visible_bug_data);
    # send mail
    # PRINT '<br />email_bug_info::Sending email to :'.$t_user_email;
    $t_ok = email_send($t_user_email, $t_subject, $t_message, '', $p_visible_bug_data['set_category'], false);
    return $t_ok;
}