function send_email($info) { //format each email $body = format_email($info, 'html'); $body_plain_txt = format_email($info, 'txt'); //setup the mailer $transport = Swift_MailTransport::newInstance(); $mailer = Swift_Mailer::newInstance($transport); $message = Swift_Message::newInstance(); $message->setSubject('Welcome to Geo Home For you'); $message->setFrom(array('*****@*****.**' => 'Site Name')); $message->setTo(array($info['email'] => $info['username'])); $message->setBody($body_plain_txt); $message->addPart($body, 'text/html'); echo "WHAT"; echo $message; //$to = "*****@*****.**"; //$sub = "Te_subject_of_your_email"; //$mess = "Dear User, \r\n\r\n"; //$mess .= "This is your message \r\n"; //$headers = "From: noreply@.com \r\n"; //$test = mail($to,$subj,$mess,$headers); //if (test){echo "TRUE";}else{echo "FALSE";} $result = $mailer->send($message); return $result; }
/** * bootstrap.php: format_email() */ function test_format_email() { $data = array('' => '', 'test' => 'test', '*****@*****.**' => '*****@*****.**', 'test@[127.0.0.1]' => 'test@[127.0.0.1]', '*****@*****.**' => '*****@*****.**'); foreach ($data as $value => $expected) { $result = format_email($value); $this->assertEquals($expected, $result, "Invalid format_email() result for {$value}"); } }
function send_email($info) { $body = format_email($info, 'html'); $body_plain_txt = format_email($info, 'txt'); $transport = Swift_MailTransport::newInstance(); $mailer = Swift_Mailer::newInstance($transport); $message = Swift_Message::newInstance(); $message->setSubject('Please validate your email'); $message->setFrom(array('*****@*****.**' => 'Cravatte Loïc')); $message->setTo(array($info['email'] => $info['username'])); $message->setBody($body_plain_txt); $message->addPart($body, 'text/html'); $result = $mailer->send($message); return $result; }
function send_email($info) { //format each email $body = format_email($info, 'html'); $body_plain_txt = format_email($info, 'txt'); //setup the mailer $transport = Swift_MailTransport::newInstance(); $mailer = Swift_Mailer::newInstance($transport); $message = Swift_Message::newInstance(); $message->setSubject('パスワード再登録のお知らせ'); $message->setFrom(array('*****@*****.**' => 'Site Name')); $message->setTo(array($info['email'] => $info['username'])); $message->setBody($body_plain_txt); // $message ->addPart($body, 'text/html'); $result = $mailer->send($message); return $result; }
function send_email($info) { //format each email $body = format_email($info, 'html'); $body_plain_txt = format_email($info, 'txt'); //setup the mailer $transport = Swift_MailTransport::newInstance(); $mailer = Swift_Mailer::newInstance($transport); $message = Swift_Message::newInstance(); $message->setSubject('Welcome to Geo Home For you'); $message->setFrom(array('*****@*****.**' => 'Site Name')); $message->setTo(array($info['email'] => $info['username'])); $message->setBody($body_plain_txt); $message->addPart($body, 'text/html'); echo "WHAT"; echo $message; $result = $mailer->send($message); return $result; }
function email($to, $message, $subject = "Email from Your Website", $from = false) { global $_josh; error_debug("<b>email </b> sending message to <i>" . $to . "</i> with subject " . $subject); $headers = "MIME-Version: 1.0" . $_josh["newline"]; $headers .= "Content-type: text/html; charset=iso-8859-1" . $_josh["newline"]; if (!$from) { if (isset($_josh["email_default"])) { $from = $_josh["email_default"]; } else { error_handle("email from address missing", "please call this function with a from address, or specify one in the config file.", true); } } $to = format_email($to); $headers .= "From: " . format_email($from) . $_josh["newline"]; if (!mail($to, $subject, $message, $headers)) { error_handle("email not sent", "sorry, an unexpected error occurred while sending your mail.", true); } return true; }
/** ---------------------------------------------------------------------------- * @param type $nickname * @param type $email * @param type $key * ----------------------------------------------------------------------------- */ function sendConfirmedEmail($nickname, $firstname, $email) { $template_php = true; if ($template_php) { $template_html = createConfirmTemplate('html'); $template_txt = createConfirmTemplate('txt'); } else { $filedir = 'master/ThreeScriptTools/src/mail/templates'; $filename = 'register_template'; $root = $_SERVER['DOCUMENT_ROOT'] . "/{$filedir}"; $template_html = file_get_contents("{$root}/{$filename}.html"); $template_txt = file_get_contents("{$root}/{$filename}.txt"); } $info = array('nickname' => $nickname, 'firstname' => $firstname, 'email' => $email, 'html' => $template_html, 'txt' => $template_txt); $info["html"] = format_email($template_html, $info, "html"); $info["txt"] = format_email($template_txt, $info, "txt"); $res = send_email($info); if ($res) { echo "the email was sent to {$email}"; } else { echo "the email wasn't sent to {$email}: '{$res}'"; } }
<?php include "../include.php"; if ($posting) { $_POST["email"] = format_email($_POST["email"]); $_POST["phone"] = format_phone($_POST["phone"]); //create request //todo ~ check whether staff already exists -- forward to password reset if ($id = db_grab("SELECT userID FROM intranet_users WHERE email = '" . $_POST["email"] . "' AND isActive = 1")) { url_change("account_exists.php"); } elseif ($id = db_grab("SELECT id FROM users_requests WHERE email = '" . $_POST["email"] . "'")) { db_query("UPDATE users_requests SET\n\t\t\tfirstname = '" . $_POST["firstname"] . "', \n\t\t\tlastname = '" . $_POST["lastname"] . "',\n\t\t\tnickname = '" . $_POST["nickname"] . "',\n\t\t\ttitle = '" . $_POST["title"] . "',\n\t\t\tphone = '" . $_POST["phone"] . "',\n\t\t\temail = '" . $_POST["email"] . "',\n\t\t\tdepartmentID = '" . $_POST["departmentID"] . "',\n\t\t\tcorporationID = '" . $_POST["corporationID"] . "',\n\t\t\tofficeID = '" . $_POST["officeID"] . "',\n\t\t\tbio = '" . $_POST["bio"] . "',\n\t\t\tcreatedOn = GETDATE()\n\t\tWHERE email = '" . $_POST["email"] . "'"); email_user($_josh["email_admin"], "Repeat Account Request", drawEmptyResult($_POST["firstname"] . " " . $_POST["lastname"] . ' is <a href="http://' . $request["host"] . '/staff/add_edit.php?requestID=' . $id . '">re-requesting an account</a>.')); } else { $id = db_query("INSERT INTO users_requests (\n\t\t\tfirstname, \n\t\t\tlastname,\n\t\t\tnickname,\n\t\t\ttitle,\n\t\t\tphone,\n\t\t\temail,\n\t\t\tdepartmentID,\n\t\t\tcorporationID,\n\t\t\tofficeID,\n\t\t\tbio,\n\t\t\tcreatedOn\n\t\t) VALUES (\n\t\t\t'" . $_POST["firstname"] . "', \n\t\t\t'" . $_POST["lastname"] . "',\n\t\t\t'" . $_POST["nickname"] . "',\n\t\t\t'" . $_POST["title"] . "',\n\t\t\t'" . $_POST["phone"] . "',\n\t\t\t'" . $_POST["email"] . "',\n\t\t\t" . $_POST["departmentID"] . ",\n\t\t\t" . $_POST["corporationID"] . ",\n\t\t\t" . $_POST["officeID"] . ",\n\t\t\t'" . $_POST["bio"] . "',\n\t\t\tGETDATE()\n\t\t)"); //prepare email reset($_POST); $message = ""; while (list($key, $value) = each($_POST)) { $message .= '<tr><td class="left">' . $key . '</td>'; if ($key == "email") { $message .= '<td><a href="mailto:' . $value . '">' . $value . '</a></td></tr>'; } elseif ($key == "departmentID") { $r = db_grab("SELECT departmentName FROM intranet_departments WHERE departmentID = " . $value); $message .= '<td>' . $r . '</td></tr>'; } elseif ($key == "officeID") { $r = db_grab("SELECT name FROM intranet_offices WHERE id = " . $value); $message .= '<td>' . $r . '</td></tr>'; } elseif ($key == "corporationID") { $message .= '<td>' . db_grab("SELECT description FROM organizations WHERE id = " . $value) . '</td></tr>'; } elseif ($key == "Additional Info") {
function check_email($value, $empty, &$params, &$form) { global $db, $tpl, $tables; $rs = $db->Execute("SELECT `ID`, `TITLE`, `URL` FROM `{$tables['link']['name']}` WHERE `URL` = " . $db->qstr($form['URL']) . " OR `TITLE` = " . $db->qstr($form['TITLE'])); $err['dir'] = array(); while (!$rs->EOF) { if (strcasecmp($rs->Fields('URL'), $form['URL']) == 0) { $err['dir'][] = 'URL'; } if (strcasecmp($rs->Fields('TITLE'), $form['TITLE']) == 0) { $err['dir'][] = 'TITLE'; } $rs->MoveNext(); } $rs = $db->Execute("SELECT * FROM `{$tables['email']['name']}` WHERE `URL` = " . $db->qstr($form['URL']) . " OR `TITLE` = " . $db->qstr($form['TITLE']) . " OR `EMAIL` = " . $db->qstr($form['EMAIL'])); $err['email'] = array(); while (!$rs->EOF) { $row = array('EMAIL' => htmlentities(format_email($rs->Fields('EMAIL'), $rs->Fields('NAME'))), 'TITLE' => $rs->Fields('TITLE'), 'URL' => $rs->Fields('URL'), 'DATE' => $rs->Fields('DATE_SENT')); if (strcasecmp($rs->Fields('EMAIL'), $form['EMAIL']) == 0) { $row['TYPE'] = 'EMAIL'; } if (strcasecmp($rs->Fields('URL'), $form['URL']) == 0) { $row['TYPE'] = 'URL'; } if (strcasecmp($rs->Fields('TITLE'), $form['TITLE']) == 0) { $row['TYPE'] = 'TITLE'; } $err['email'][] = $row; $rs->MoveNext(); } if (count($err['dir']) > 0 || count($err['email']) > 0) { $tpl->assign('email_send_errors', $err); return $_REQUEST['IGNORE']; } return 1; }
/** * Return a list of all identities linked with this user * * @param string $sql_add Optional WHERE clauses * @param bool $formatted Format identity email and name * * @return array List of identities */ function list_identities($sql_add = '', $formatted = false) { $result = array(); $sql_result = $this->db->query("SELECT * FROM " . $this->db->table_name('identities') . " WHERE del <> 1 AND user_id = ?" . ($sql_add ? " " . $sql_add : "") . " ORDER BY " . $this->db->quote_identifier('standard') . " DESC, " . $this->db->quote_identifier('name') . " ASC, " . $this->db->quote_identifier('email') . " ASC, " . $this->db->quote_identifier('identity_id') . " ASC", $this->ID); while ($sql_arr = $this->db->fetch_assoc($sql_result)) { if ($formatted) { $ascii_email = format_email($sql_arr['email']); $utf8_email = format_email(rcube_utils::idn_to_utf8($ascii_email)); $sql_arr['email_ascii'] = $ascii_email; $sql_arr['email'] = $utf8_email; $sql_arr['ident'] = format_email_recipient($ascii_email, $sql_arr['name']); } $result[] = $sql_arr; } return $result; }
function begin_users_env_nbm($is_to_send_mail = false) { global $user, $lang, $lang_info, $conf, $env_nbm; // Save $user, $lang_info and $lang arrays (include/user.inc.php has been executed) $env_nbm['save_user'] = $user; // Save current language to stack, necessary because $user change during NBM switch_lang_to($user['language']); $env_nbm['is_to_send_mail'] = $is_to_send_mail; if ($is_to_send_mail) { // Init mail configuration $env_nbm['email_format'] = get_str_email_format($conf['nbm_send_html_mail']); $env_nbm['send_as_name'] = (isset($conf['nbm_send_mail_as']) and !empty($conf['nbm_send_mail_as'])) ? $conf['nbm_send_mail_as'] : get_mail_sender_name(); $env_nbm['send_as_mail_address'] = get_webmaster_mail_address(); $env_nbm['send_as_mail_formated'] = format_email($env_nbm['send_as_name'], $env_nbm['send_as_mail_address']); // Init mail counter $env_nbm['error_on_mail_count'] = 0; $env_nbm['sent_mail_count'] = 0; // Save sendmail message info and error in the original language $env_nbm['msg_info'] = l10n('Mail sent to %s [%s].'); $env_nbm['msg_error'] = l10n('Error when sending email to %s [%s].'); } }
function send_email($info, $type) { //format each email $body = format_email($info, 'html', $type); $body_plain_txt = format_email($info, 'txt', $type); //setup the mailer $transport = Swift_MailTransport::newInstance(); $mailer = Swift_Mailer::newInstance($transport); $message = Swift_Message::newInstance(); $message->setSubject($info['temat']); $message->setFrom(array('*****@*****.**' => 'wszechwiedzacy.pl')); $message->setTo(array($info['email'] => $info['username'])); $message->setBody($body_plain_txt); $message->addPart($body, 'text/html'); $result = $mailer->send($message); return $result; }
<?php $pageIsPublic = true; include '../include.php'; if ($posting) { $_POST['email'] = format_email($_POST['email']); $_POST['phone'] = format_phone($_POST['phone']); format_post_nulls('departmentID, officeID'); //create request //todo ~ check whether staff already exists -- forward to password reset if ($id = db_grab('SELECT id FROM users WHERE email = "' . $_POST['email'] . '" AND is_active = 1')) { url_change('account_exists.php'); } elseif (getOption('requests') && ($id = db_grab('SELECT id FROM users_requests WHERE email = "' . $_POST['email'] . '"'))) { db_save('users_requests', $id); emailAdmins('Repeat Account Request', $_POST['firstname'] . ' ' . $_POST['lastname'] . ' is ' . draw_link(url_base() . '/staff/add_edit.php?requestID=' . $id, 're-requesting an account')); } else { if (getOption('requests')) { $id = db_save('users_requests'); //if (getOption('channels')) db_checkboxes('email_prefs', 'requests_to_channels_prefs', 'request_id', 'channel_id', $id); $subject = 'New User Request'; $link = url_base() . '/staff/add_edit.php?requestID=' . $id; } else { $id = db_save('users'); if (getOption('channels')) { db_checkboxes('email_prefs', 'users_to_channels_prefs', 'user_id', 'channel_id', $id); } $subject = 'New User Registration'; $link = url_base() . '/staff/add_edit.php?id=' . $id; emailInvite($id); } //prepare email
function email_invite($id, $email, $name) { global $_josh, $user; $email = format_email($email); $message = '<tr><td class="text"> Welcome ' . $name . '! You can <a href="http://' . $_josh["request"]["host"] . '/login/password_reset.php?id=' . $id . '">log in to the Intranet now</a>. The system will prompt you to pick a password and update your contact information. <br><br> If you run into problems, please ask <a href="mailto:' . $user["email"] . '">' . $user["full_name"] . '</a> for help. </td></tr>'; email_user($email, "Intranet Login Information", $message); }
<?php include '../include.php'; $emails = array('*****@*****.**', 'foo [at] bar', 'test@mweb.co.za;testest@clara.net'); $emails = db_array('SELECT email FROM users WHERE is_active = 1 ORDER BY email'); $good = $bad = array(); foreach ($emails as $e) { if (!($good[] = format_email($e))) { array_pop($good); $bad[] = $e; } } echo 'good emails:' . draw_list($good); echo '<hr>bad emails:' . draw_list($bad); //email($emails, 'this is some test content', 'this is a test');
define("SITE_URL", "http://wszechwiedzacy.pl/"); define("LIB_PATH", SITE_ROOT . "includes"); require_once LIB_PATH . DS . "config.php"; require_once LIB_PATH . DS . "functions.php"; require_once LIB_PATH . DS . "database.php"; require_once LIB_PATH . DS . "question.php"; require_once SITE_ROOT . DS . "lib/swift_required.php"; $info = array('temat' => 'Aktualizacja do wersji beta 0.8', 'key' => '23'); $q = "SELECT user_name, email FROM users WHERE subscribed = 1 LIMIT 300"; $r = $db->query($q); while ($row = mysql_fetch_assoc($r)) { $info['username'] = $row['user_name']; $info['email'] = $row['email']; //format each email $body = format_email($info, 'html', 'test'); $body_plain_txt = format_email($info, 'txt', 'test'); //setup the mailer $transport = Swift_MailTransport::newInstance(); $mailer = Swift_Mailer::newInstance($transport); $message = Swift_Message::newInstance(); $message->setSubject($info['temat']); $message->setFrom(array('*****@*****.**' => 'wszechwiedzacy.pl')); $message->setTo(array($info['email'] => $info['username'])); $message->setBody($body_plain_txt); $message->addPart($body, 'text/html'); $result = $mailer->send($message); if ($result) { echo "<h2>Mail to " . $info['username'] . " was successfully sent!</h2>"; } else { echo "Mail to " . $info['username'] . " was NOT sent!"; }
function account_user($uname) { global $user, $theme; function module($name, $module, $username) { global $theme; if ($module["user"] && ($block = $module["user"]($username, "user", "view"))) { if ($block["content"]) { $theme->box($block["subject"], $block["content"]); } } } if ($user->id && $user->userid == $uname) { $output .= "<TABLE BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n"; $output .= " <TR><TD ALIGN=\"right\"><B>" . t("Username") . ":</B></TD><TD>{$user->userid}</TD></TR>\n"; $output .= " <TR><TD ALIGN=\"right\"><B>" . t("E-mail") . ":</B></TD><TD>" . format_email($user->fake_email) . "</A></TD></TR>\n"; $output .= " <TR><TD ALIGN=\"right\"><B>" . t("Homepage") . ":</B></TD><TD>" . format_url($user->url) . "</TD></TR>\n"; $output .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>" . t("Bio") . ":</B></TD><TD>" . check_output($user->bio) . "</TD></TR>\n"; $output .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>" . t("Signature") . ":</B></TD><TD>" . check_output($user->signature) . "</TD></TR>\n"; $output .= "</TABLE>\n"; // Display account information: $theme->header(); $theme->box(t("Personal information"), $output); $theme->footer(); } elseif ($uname && ($account = account_get_user($uname))) { $block1 .= "<TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACING=\"1\">\n"; $block1 .= " <TR><TD ALIGN=\"right\"><B>" . t("Username") . ":</B></TD><TD>{$account->userid}</TD></TR>\n"; $block1 .= " <TR><TD ALIGN=\"right\"><B>" . t("E-mail") . ":</B></TD><TD>" . format_email($account->fake_email) . "</TD></TR>\n"; $block1 .= " <TR><TD ALIGN=\"right\"><B>" . t("Homepage") . ":</B></TD><TD>" . format_url($account->url) . "</TD></TR>\n"; $block1 .= " <TR><TD ALIGN=\"right\"><B>" . t("Bio") . ":</B></TD><TD>" . check_output($account->bio) . "</TD></TR>\n"; $block1 .= "</TABLE>\n"; $result = db_query("SELECT c.cid, c.pid, c.lid, c.subject, c.timestamp, s.subject AS story FROM comments c LEFT JOIN users u ON u.id = c.author LEFT JOIN stories s ON s.id = c.lid WHERE u.userid = '{$uname}' AND s.status = 2 AND c.link = 'story' AND s.timestamp > " . (time() - 1209600) . " ORDER BY cid DESC LIMIT 10"); while ($comment = db_fetch_object($result)) { $block2 .= "<TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACING=\"1\">\n"; $block2 .= " <TR><TD ALIGN=\"right\"><B>" . t("Comment") . ":</B></TD><TD><A HREF=\"story.php?id={$comment->lid}&cid={$comment->cid}&pid={$comment->pid}#{$comment->cid}\">" . check_output($comment->subject) . "</A></TD></TR>\n"; $block2 .= " <TR><TD ALIGN=\"right\"><B>" . t("Date") . ":</B></TD><TD>" . format_date($comment->timestamp) . "</TD></TR>\n"; $block2 .= " <TR><TD ALIGN=\"right\"><B>" . t("Story") . ":</B></TD><TD><A HREF=\"story.php?id={$comment->lid}\">" . check_output($comment->story) . "</A></TD></TR>\n"; $block2 .= "</TABLE>\n"; $block2 .= "<P>\n"; $comments++; } // Display account information: $theme->header(); if ($block1) { $theme->box(strtr(t("%a's user information"), array("%a" => $uname)), $block1); } if ($block2) { $theme->box(strtr(t("%a has posted %b recently"), array("%a" => $uname, "%b" => format_plural($comments, "comment", "comments"))), $block2); } module_iterate("module", $uname); $theme->footer(); } else { // Display login form: $theme->header(); $theme->box(t("Create user account"), account_create()); $theme->box(t("E-mail new password"), account_email()); $theme->footer(); } }
define("SITE_URL", "http://wszechwiedzacy.pl/"); define("LIB_PATH", SITE_ROOT . "includes"); require_once LIB_PATH . DS . "config.php"; require_once LIB_PATH . DS . "functions.php"; require_once LIB_PATH . DS . "database.php"; require_once LIB_PATH . DS . "question.php"; require_once SITE_ROOT . DS . "lib/swift_required.php"; $info = array('temat' => 'Aktualizacja do wersji beta 0.8'); $q = "SELECT user_name, email FROM users WHERE subscribed = 1 LIMIT 300"; $r = $db->query($q); while ($row = mysql_fetch_assoc($r)) { $info['username'] = $row['user_name']; $info['email'] = $row['email']; //format each email $body = format_email($info, 'html', 'aktualizacja'); $body_plain_txt = format_email($info, 'txt', 'aktualizacja'); //setup the mailer $transport = Swift_MailTransport::newInstance(); $mailer = Swift_Mailer::newInstance($transport); $message = Swift_Message::newInstance(); $message->setSubject($info['temat']); $message->setFrom(array('*****@*****.**' => 'wszechwiedzacy.pl')); $message->setTo(array($info['email'] => $info['username'])); $message->setBody($body_plain_txt); $message->addPart($body, 'text/html'); if ($mailer->send($message)) { echo "<h2>Mail to " . $info['username'] . " was successfully sent!</h2>"; } else { echo "<h2>Mail to " . $info['username'] . " was NOT sent!</h2>"; } }
$headers .= "Content-type: text/plain; charset=iso-8859-1\n"; $headers .= "Content-Transfer-Encoding: quoted-printable"; mail($comments_address, $subject, $c_msg, $headers); if ($_POST['bakecookie'] == 'on') { setcookie("blogatron_author", "{$c_author}", time() + 3600 * 24 * 365, "/"); setcookie("blogatron_email", "{$c_email}", time() + 3600 * 24 * 365, "/"); setcookie("blogatron_url", "{$c_url}", time() + 3600 * 24 * 365, "/"); } if ($_POST['bakecookie'] == 'off') { setcookie("blogatron_author", "", time() - 3600 * 24, "/"); setcookie("blogatron_email", "", time() - 3600 * 24, "/"); setcookie("blogatron_url", "", time() - 3600 * 24, "/"); } $c_text = strip_tags($c_text, '<a><b><em><q><del>'); $c_author = format_comment($c_author); $c_email = format_email($c_email); $c_url = format_url($c_url); $date = time() + $offset * 3600; $sql = "\n\t\t\tINSERT INTO comments set \n\t\t\tc_author = ('{$c_author}'),\n\t\t\tc_text = ('{$c_text}'),\n\t\t\tc_email = ('{$c_email}'),\n\t\t\tc_url = ('{$c_url}'),\n\t\t\tc_ip = ('{$c_ip}'),\n\t\t\tdate = ('{$date}'),\n\t\t\teid = ('{$eid}')"; if (!($result = @mysql_query($sql))) { print "<p>Der skete en fejl: " . mysql_error() . "</p>"; print "<p>{$sql}</p>"; } header("Location: {$comment_url}#c"); } } else { print_header(". {$blog_title} | kukabuxilah .", "stil.css", $domain_name, $description, $key_words, $dc_title, $install_path); ?> <div id="container"> <div id="top"> <div id="banner2">