本文整理汇总了PHP中format_email函数的典型用法代码示例。如果您正苦于以下问题:PHP format_email函数的具体用法?PHP format_email怎么用?PHP format_email使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了format_email函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send_email
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('noreply@geomail.com' => 'Site Name'));
$message->setTo(array($info['email'] => $info['username']));
$message->setBody($body_plain_txt);
$message->addPart($body, 'text/html');
echo "WHAT";
echo $message;
//$to = "tepnimitl@gmail.com";
//$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;
}
示例2: test_format_email
/**
* bootstrap.php: format_email()
*/
function test_format_email()
{
$data = array('' => '', 'test' => 'test', 'test@test.tld' => 'test@test.tld', 'test@[127.0.0.1]' => 'test@[127.0.0.1]', 'TEST@TEST.TLD' => 'TEST@test.tld');
foreach ($data as $value => $expected) {
$result = format_email($value);
$this->assertEquals($expected, $result, "Invalid format_email() result for {$value}");
}
}
示例3: send_email
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('cravatteloic@gmail.com.com' => '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;
}
示例4: send_email
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('noreply@sitename.com' => '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;
}
示例5: email
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;
}
示例6: sendConfirmedEmail
/** ----------------------------------------------------------------------------
* @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}'";
}
}
示例7: format_email
<?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") {
示例8: check_email
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;
}
示例9: list_identities
/**
* 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;
}
示例10: begin_users_env_nbm
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].');
}
}
示例11: send_email
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('kontakt@wszechwiedzacy.pl' => '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;
}
示例12: format_email
<?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
示例13: email_invite
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);
}
示例14: array
<?php
include '../include.php';
$emails = array('josh@joshreisner.com', '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');
示例15: define
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('kontakt@wszechwiedzacy.pl' => '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!";
}