Exemple #1
0
function print_email_link_with_subject($p_email, $p_text, $p_bug_id)
{
    $t_subject = email_build_subject($p_bug_id);
    echo get_email_link_with_subject($p_email, $p_text, $t_subject);
}
Exemple #2
0
/**
 * print a mailto: href link with subject
 *
 * @param string $p_email  Email Address.
 * @param string $p_text   Link text to display to user.
 * @param string $p_bug_id The bug identifier.
 * @return void
 */
function print_email_link_with_subject($p_email, $p_text, $p_bug_id)
{
    $t_bug = bug_get($p_bug_id, true);
    if (!access_has_project_level(config_get('show_user_email_threshold', null, null, $t_bug->project_id), $t_bug->project_id)) {
        echo $p_text;
        return;
    }
    $t_subject = email_build_subject($p_bug_id);
    echo get_email_link_with_subject($p_email, $p_text, $t_subject);
}
Exemple #3
0
/**
 * Send a bug reminder to the given user(s), or to each user if the first parameter is an array
 *
 * @param int|array $p_recipients user id or list of user ids array to send reminder to
 * @param int $p_bug_id Issue for which the reminder is sent
 * @param string $p_message Optional message to add to the e-mail
 * @return array List of users ids to whom the reminder e-mail was actually sent
 */
function email_bug_reminder($p_recipients, $p_bug_id, $p_message)
{
    if (!is_array($p_recipients)) {
        $p_recipients = array($p_recipients);
    }
    $t_project_id = bug_get_field($p_bug_id, 'project_id');
    $t_sender_id = auth_get_current_user_id();
    $t_sender = user_get_name($t_sender_id);
    $t_subject = email_build_subject($p_bug_id);
    $t_date = date(config_get('normal_date_format'));
    $result = array();
    foreach ($p_recipients as $t_recipient) {
        lang_push(user_pref_get_language($t_recipient, $t_project_id));
        $t_email = user_get_email($t_recipient);
        if (access_has_project_level(config_get('show_user_email_threshold'), $t_project_id, $t_recipient)) {
            $t_sender_email = ' <' . user_get_email($t_sender_id) . '>';
        } else {
            $t_sender_email = '';
        }
        $t_header = "\n" . lang_get('on_date') . " {$t_date}, {$t_sender} {$t_sender_email} " . lang_get('sent_you_this_reminder_about') . ": \n\n";
        $t_contents = $t_header . string_get_bug_view_url_with_fqdn($p_bug_id, $t_recipient) . " \n\n{$p_message}";
        if (ON == config_get('enable_email_notification')) {
            $t_id = email_store($t_email, $t_subject, $t_contents);
            if ($t_id !== null) {
                $result[] = $t_recipient;
            }
            log_event(LOG_EMAIL, "queued reminder email #{$t_id} for U{$t_recipient}");
        }
        lang_pop();
    }
    if (OFF == config_get('email_send_using_cronjob')) {
        email_send_all();
    }
    return $result;
}
Exemple #4
0
/**
 * Send bug info to given user
 * return true on success
 * @param array   $p_visible_bug_data       Array of bug data information.
 * @param string  $p_message_id             A message identifier.
 * @param integer $p_user_id                A valid user identifier.
 * @param array   $p_header_optional_params Array of additional email headers.
 * @return void
 */
function email_bug_info_to_one_user(array $p_visible_bug_data, $p_message_id, $p_user_id, array $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;
    }
    # 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
    email_store($t_user_email, $t_subject, $t_message, $t_mail_headers);
    return;
}
/**
 * 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;
}
Exemple #6
0
function print_email_link_with_subject($p_email, $p_text, $p_bug_id)
{
    global $g_mantis_bug_table;
    $t_subject = email_build_subject($p_bug_id);
    print get_email_link_with_subject($p_email, $p_text, $t_subject);
}