function do_it($params) { global $_journo; $txt = build_email_body($params); $subject = "[from {$params['name']}] {$_journo['prettyname']} on journalisted"; $success = jl_send_text_email($params['email'], OPTION_WEB_DOMAIN, OPTION_TEAM_EMAIL, $subject, $txt); if ($success) { ?> <div class="infomessage"> <p>Thank you - email sent.</p> </div> <?php } else { ?> <div class="errormessage"> <p>Sorry, there was a problem, and the email was not sent</p> </div> <?php } ?> <p><a href="/<?php echo $_journo['ref']; ?> ">Go back to <?php echo $_journo['prettyname']; ?> 's page</a></p> <?php $context = array('email' => $params['email'], 'name' => $params['name'], 'message' => $params['message'], 'success' => $success, 'remote_addr' => $_SERVER["REMOTE_ADDR"]); eventlog_Add('forward-profile', $_journo['id'], $context); }
function DoConfirmationEmail() { global $q_stash, $q_email, $q_name, $q_rememberme; if (is_null($q_stash)) { // create a default stashed request $template_data = array('reason_web' => "Log in", 'reason_email' => "Log in to Journalisted", 'reason_email_subject' => 'Log in to Journalisted'); $q_stash = stash_new_request("POST", "/login", null, rabx_serialise($template_data), null); } $token = auth_token_store('login', array('email' => $q_email, 'name' => $q_name, 'stash' => $q_stash)); db_commit(); /* send out a confirmation email */ $url = OPTION_BASE_URL . "/login?t={$token}"; $ex = stash_get_extra($q_stash); $values = rabx_unserialise($ex); $body = "Please click on the link below to confirm your email address.\n" . "{$values['reason_email']}\n" . "\n" . "{$url}\n" . "\n"; $subject = $values['reason_email_subject']; $from_name = "Journalisted"; $from_email = OPTION_TEAM_EMAIL; if (!OPTION_JL_BYPASS_LOGIN_EMAIL) { jl_send_text_email($q_email, $from_name, $from_email, $subject, $body); } return $url; }
function do_SendWelcomeEmail() { $person_id = get_http_var('person_id'); $journo_id = get_http_var('journo_id'); $emailtext = get_http_var('emailtext'); $subject = get_http_var('subject'); $journo = db_getRow("SELECT * FROM journo WHERE id=?", $journo_id); $person = db_getRow("SELECT * FROM person WHERE id=?", $person_id); $from_name = "Journalisted"; $from_email = OPTION_TEAM_EMAIL; if (jl_send_text_email($person['email'], $from_name, $from_email, $subject, $emailtext)) { ?> <div class="action_summary"> Sent welcome email to <?php echo h($person['email']); ?> . </div> <?php } else { ?> <div class="action_error"> <p>Oops... sending the email to <?php echo h($person['email']); ?> failed.</p> <p>You probably want to try and send one manually instead...</p> </div> <?php } }