Esempio n. 1
0
function evel_check_error($data)
{
    if ($error_message = evel_get_error($data)) {
        err($error_message);
    }
}
Esempio n. 2
0
function emailform_send_message()
{
    global $emailformfields;
    $sendto = OPTION_CONTACT_EMAIL;
    $mailbody = '';
    $subject = 'no subject';
    $sender = '';
    $messagesent = 0;
    foreach ($emailformfields as $defs) {
        // loop through emailformfields and fill in the mail body
        if (isset($defs['nomail']) && $defs['nomail']) {
            continue;
        }
        if (isset($defs['emailoutput']) && isset($_POST[$defs['inputname']])) {
            // this value goes into the subject or sender
            if ($defs['emailoutput'] == 'subject') {
                $subject = 'Message from ' . OPTION_WEB_DOMAIN . ': ' . $_POST[$defs['inputname']];
            }
            if ($defs['emailoutput'] == 'sender') {
                $sender = $_POST[$defs['inputname']];
            }
        } else {
            if (isset($_POST[$defs['inputname']]) && $defs['inputtype'] != 'submit') {
                $mailbody .= $defs['label'] . ': ' . $_POST[$defs['inputname']] . "\n\n";
            }
        }
    }
    $success = FALSE;
    if ($sender && $mailbody) {
        $from = $_POST['name'] ? array($sender, $_POST['name']) : $sender;
        $spec = array('_unwrapped_body_' => $mailbody, 'Subject' => $subject, 'From' => $from, 'To' => array(array($sendto, 'WriteToThem')));
        $result = evel_send($spec, $sendto);
        $error = evel_get_error($result);
        if ($error) {
            error_log("fyr_send_email_internal: " . $error);
        }
        $success = $error ? FALSE : TRUE;
    }
    return $success;
}