本文整理汇总了PHP中email_send函数的典型用法代码示例。如果您正苦于以下问题:PHP email_send函数的具体用法?PHP email_send怎么用?PHP email_send使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了email_send函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateHtmlEmail
/**
*
*
*/
function generateHtmlEmail(&$smarty, $template_file, $mailCfg)
{
// same objet that is returned by email_send
$op = new stdClass();
$op->status_ok = true;
$op->msg = 'ok';
$html_report = $smarty->fetch($template_file);
if (!property_exists($mailCfg, 'from')) {
$mailCfg->from = $_SESSION['currentUser']->emailAddress;
}
if (!property_exists($mailCfg, 'to')) {
$mailCfg->to = $mailCfg->from;
}
if ($mailCfg->to == "") {
$op->status_ok = false;
$op->msg = lang_get("error_sendreport_no_email_credentials");
} else {
// TICKET 6905: Link to test case is still raw link (no title) in email(HTML) type of test report
// array('strip_email_links' => false)
$op = email_send($mailCfg->from, $mailCfg->to, $mailCfg->subject, $html_report, $mailCfg->cc, false, true, array('strip_email_links' => false));
if ($op->status_ok) {
$op->msg = sprintf(lang_get('mail_sent_to'), $mailCfg->to);
}
}
return $op;
}
示例2: sendErrorReport
function sendErrorReport()
{
$options = getOptions();
$extra_vars = isset($options['params']) ? $options['params'] : false;
$content = parseEmail($options['email'], $extra_vars);
email_send($options['mailTo'], "Une erreur s'est produite sur OpenNAS", $content, $outError);
exit($outError);
}
示例3: quick_mail
public function quick_mail()
{
$RequestMethod = $this->input->server('REQUEST_METHOD');
if ($RequestMethod == "POST") {
$subject = $this->input->post('subject');
$msg = $this->input->post('msg');
email_send($this->input->post('emailto'), $subject, $msg);
$this->session->set_flashdata('log_sucess', 'Email Successfully Send');
redirect(site_url() . 'administrator/dashboard');
}
}
示例4: send_transaction_mail
function send_transaction_mail($cust_email, $mer_email) {
if (!empty($cust_email)) {
$to[] = $cust_email;
}
if (!empty($mer_email)) {
$to[] = $mer_email;
}
$sub = 'Payment Transaction';
$msg = 'Payment Transaction Done Please check the Portal for Details';
email_send($to, $sub, $msg, $cc = '', $bcc = '', $attach = '');
}
示例5: generateHtmlEmail
/**
*
*
*/
function generateHtmlEmail(&$smarty, $template_file, $mailCfg)
{
// same objet that is returned by email_send
$op = new stdClass();
$op->status_ok = true;
$op->msg = 'ok';
$html_report = $smarty->fetch($template_file);
if (!property_exists($mailCfg, 'from')) {
$mailCfg->from = $_SESSION['currentUser']->emailAddress;
}
if (!property_exists($mailCfg, 'to')) {
$mailCfg->to = $mailCfg->from;
}
if ($mailCfg->to == "") {
$op->status_ok = false;
$op->msg = lang_get("error_sendreport_no_email_credentials");
} else {
$op = email_send($mailCfg->from, $mailCfg->to, $mailCfg->subject, $html_report, $mailCfg->cc, false, true);
if ($op->status_ok) {
$op->msg = sprintf(lang_get('mail_sent_to'), $mailCfg->to);
}
}
return $op;
}
示例6: set_get
//verify a users email
require '../includes/config/config.php';
//get variables
$email = set_get('e', '');
if (empty($email) || !email_is_valid($email)) {
notices_set('Invalid email.', 'error');
do_redirect();
}
//check if it is valid
$sql = sql_query(" SELECT id, confirm FROM `users` WHERE email='{$email}' LIMIT 1 ");
if (sql_count($sql) <= 0) {
notices_set('Invalid email.', 'error');
do_redirect();
}
//check if account already verified
$data = sql_fetch($sql);
if (!isset($data['confirm'])) {
//account already confirmed
notices_set('Email already confirmed.', 'success');
do_redirect();
}
//create account confirm
$confirm = confirm_token_create($email);
//update account with new verify code
sql_query(" UPDATE `users` SET confirm='{$confirm}' WHERE id='{$data['id']}' LIMIT 1 ");
//send email
email_send('verify_resend', 'Planling Verification Code', array($email => $email), array('{{%LINK%}}' => 'http://' . MAIN_URL . '/verify?e=' . $email . '&t=' . $confirm));
//set message
notices_set('Confirmation code successfully sent!', 'success');
//redirect user
do_redirect();
示例7: test_compose_email
function test_compose_email($project_id, $test_id, $recipients, $action)
{
$display_generic_info = true;
$display_generic_url = true;
$generic_url = RTH_URL . "login.php?project_id={$project_id}&page=test_detail_page.php&test_id={$test_id}&project_id={$project_id}";
$username = session_get_username();
$project_name = session_get_project_name();
$user_details = user_get_name_by_username($username);
$first_name = $user_details[USER_FNAME];
$last_name = $user_details[USER_LNAME];
$test_detail = test_get_detail($test_id);
$test_name = $test_detail[TEST_NAME];
$status = $test_detail[TEST_STATUS];
$priority = $test_detail[TEST_PRIORITY];
$test_area = $test_detail[TEST_AREA_TESTED];
$test_type = $test_detail[TEST_TESTTYPE];
$ba_owner = $test_detail[TEST_BA_OWNER];
$qa_owner = $test_detail[TEST_QA_OWNER];
$assigned_to = $test_detail[TEST_ASSIGNED_TO];
$comments = $test_detail[TEST_COMMENTS];
# CREATE EMAIL SUBJECT AND MESSAGE
switch ($action) {
case "status_change":
$subject = "RTH: {$test_name} - Test Status Change";
$message = "The test status of {$test_name} has been updated by {$first_name} {$last_name}\r\n" . NEWLINE;
break;
case "steps_uploaded":
$subject = "RTH: {$test_name} - Test Steps Added";
$message = "Test Steps have been uploaded to {$test_name} by {$first_name} {$last_name}\r\n" . NEWLINE;
break;
}
# Generic link to results page if the $generic_url variable has been set
if ($display_generic_url) {
$message .= "Click the following link to view the Test Results:" . NEWLINE;
$message .= "{$generic_url}\n" . NEWLINE;
}
if ($display_generic_info) {
$message .= "Project Name: {$project_name}\r" . NEWLINE;
$message .= "Test Name: {$test_name}\r" . NEWLINE;
$message .= "Status: {$status}\r" . NEWLINE;
$message .= "Priority: {$priority}\r\n\r" . NEWLINE;
$message .= "Test Area: {$test_name}\r" . NEWLINE;
$message .= "Test Type: {$test_area}\r" . NEWLINE;
$message .= "BA Owner: {$ba_owner}\r" . NEWLINE;
$message .= "QA Owner: {$qa_owner}\r" . NEWLINE;
$message .= "Assigned To: {$assigned_to}\r" . NEWLINE;
$message .= "Comments: {$comments}\r\n\r" . NEWLINE;
}
email_send($recipients, $subject, $message);
}
示例8: notifyGlobalAdmins
/**
* send mail to administrators (users that have default role = administrator)
* to warn about new user created.
*
*/
function notifyGlobalAdmins(&$dbHandler, &$userObj)
{
// Get email addresses for all users that have default role = administrator
$cfg = config_get('notifications');
if (!is_null($cfg->userSignUp->to->roles)) {
foreach ($cfg->userSignUp->to->roles as $roleID) {
$roleMgr = new tlRole($roleID);
$userSet = $roleMgr->getUsersWithGlobalRole($dbHandler);
$key2loop = array_keys($userSet);
foreach ($key2loop as $userID) {
if (!isset($mail['to'][$userID])) {
$mail['to'][$userID] = $userSet[$userID]->emailAddress;
}
}
}
}
if (!is_null($cfg->userSignUp->to->users)) {
// Brute force query
$tables = tlObject::getDBTables('users');
$sql = " SELECT id,email FROM {$tables['users']} " . " WHERE login IN('" . implode("','", $cfg->userSignUp->to->users) . "')";
$userSet = $dbHandler->fetchRowsIntoMap($sql, 'id');
if (!is_null($userSet)) {
foreach ($userSet as $userID => $elem) {
if (!isset($mail['to'][$userID])) {
$mail['to'][$userID] = $elem['email'];
}
}
}
}
$mail['to'] = implode(',', $mail['to']);
// email_api uses ',' as list separator
$mail['subject'] = lang_get('new_account');
$mail['body'] = lang_get('new_account') . "\n";
$mail['body'] .= " user:{$userObj->login}\n";
$mail['body'] .= " first name:{$userObj->firstName} surname:{$userObj->lastName}\n";
$mail['body'] .= " email:{$userObj->emailAddress}\n";
// silence errors
@email_send(config_get('from_email'), $mail['to'], $mail['subject'], $mail['body']);
}
示例9: results_email
function results_email($project_id, $release_id, $build_id, $testset_id, $test_id, $recipients, $action)
{
$display_generic_info = true;
$display_generic_url = true;
$generic_url = RTH_URL . "login.php?project_id={$project_id}&page=results_test_run_page.php&release_id={$release_id}&build_id={$build_id}&testset_id={$testset_id}&test_id={$test_id}";
$username = session_get_username();
$project_name = session_get_project_name();
$release_name = admin_get_release_name($release_id);
$build_name = admin_get_build_name($build_id);
$testset_name = admin_get_testset_name($testset_id);
$user_details = user_get_name_by_username($username);
$first_name = $user_details[USER_FNAME];
$last_name = $user_details[USER_LNAME];
$row_test_detail = testset_query_test_details($testset_id, $test_id);
$test_name = $row_test_detail[TEST_NAME];
$status = $row_test_detail[TEST_TS_ASSOC_STATUS];
$finished = $row_test_detail[TEST_TS_ASSOC_FINISHED];
$assigned_to = $row_test_detail[TEST_TS_ASSOC_ASSIGNED_TO];
$comments = $row_test_detail[TEST_TS_ASSOC_COMMENTS];
$root_cause = $row_test_detail[TEST_RESULTS_ROOT_CAUSE];
# CREATE EMAIL SUBJECT AND MESSAGE
switch ($action) {
case "test_run":
$subject = "RTH: Test Run Notification - {$test_name}";
$message = "Test {$test_name} has been run by {$first_name} {$last_name}\n" . NEWLINE;
break;
case "update_test_result":
$subject = "RTH: Test Result has been Updated";
$message = "The test result for {$test_name} has been updated by {$first_name} {$last_name}\n" . NEWLINE;
break;
}
# Generic link to results page if the $generic_url variable has been set
if ($display_generic_url) {
$message .= "Click the following link to view the Test Results:" . NEWLINE;
$message .= "{$generic_url}\n" . NEWLINE;
}
if ($display_generic_info) {
$message .= "Project Name: {$project_name}\r" . NEWLINE;
$message .= "Release Name: {$release_name}\r" . NEWLINE;
$message .= "Build Name: {$build_name}\r" . NEWLINE;
$message .= "TestSet Name: {$testset_name}\r\n\r" . NEWLINE;
$message .= "Test Name: {$test_name}\r" . NEWLINE;
$message .= "Status: {$status}\r" . NEWLINE;
if (!empty($root_cause)) {
$message .= "Root Cause: {$root_cause}\r" . NEWLINE;
}
$message .= "Comments: {$comments}\r\n\r" . NEWLINE;
}
email_send($recipients, $subject, $message);
}
示例10: settings
<td bgcolor="#f4f4f4">
<span class="title">Testing Email</span>
<p>You can test the ability for Mantis to send email notifications with this form. Just click "Send Mail". If the page takes a very long time to reappear or results in an error then you will need to investigate your php/mail server settings (see PHPMailer related settings in your config_inc.php, if they don't exist, copy from config_defaults_inc.php). Note that errors can also appear in the server error log. More help can be found at the <a href="http://www.php.net/manual/en/ref.mail.php">PHP website</a> if you are using the mail() PHPMailer sending mode.</p>
<?php
if ($f_mail_test) {
echo '<b><font color="#ff0000">Testing Mail</font></b> - ';
# @@@ thraxisp - workaround to ensure a language is set without authenticating
# will disappear when this is properly localized
lang_push('english');
$t_email_data = new EmailData();
$t_email_data->email = config_get_global('administrator_email');
$t_email_data->subject = 'Testing PHP mail() function';
$t_email_data->body = 'Your PHP mail settings appear to be correctly set.';
$t_email_data->metadata['priority'] = config_get('mail_priority');
$t_email_data->metadata['charset'] = lang_get('charset', lang_get_current());
$result = email_send($t_email_data);
#$result = email_send( config_get_global( 'administrator_email' ), 'Testing PHP mail() function', 'Your PHP mail settings appear to be correctly set.');
if (!$result) {
echo ' PROBLEMS SENDING MAIL TO: ' . config_get_global('administrator_email') . '. Please check your php/mail server settings.<br />';
} else {
echo ' mail() send successful.<br />';
}
}
?>
<form method="post" action="<?php
echo $_SERVER['PHP_SELF'];
?>
#email">
Email Address: <?php
echo config_get_global('administrator_email');
?>
示例11: mysqli_fetch_assoc
// codigo correcto
if (mysqli_num_rows($q_user) == 1) {
$r_user = mysqli_fetch_assoc($q_user);
$sql = "UPDATE usuarios SET password = '" . sha1($_POST['pass']) . "' WHERE recuperacion = '" . $_POST['codigo'] . "'";
$q_pass = mysqli_query($link, $sql);
//Cambio pass correcto
if (mysqli_errno($link) == 0) {
$sql = "UPDATE usuarios SET recuperacion = '0' WHERE recuperacion = '" . $_POST['codigo'] . "'";
//mysqli_query($link, $sql);
print "<div class='centrar'><div class='ok_ajustable'>Enhorabuena, tu contraseña nueva se a guardado, ya puedes acceder a <a href='login.php'>" . Sitio . "</a> con ella.<br>\n\t\t\t\t\t\t\t\tTambien te hemos mandado un email a tu direccion con la contraseña nueva</div></div>";
$destinatario_email = $r_user['email'];
$destinatario_name = $r_user['nombre'] . " " . $r_user['apellidos'];
$titulo = "Contraseña nueva - " . Sitio;
// No separar del borde
$mensaje = "\n<html>\n<body style=\"background-color:#3869A0;text-align:center;padding:20px;\">\n<b style=\"color:white;font-size:40px;\">" . Sitio . "</b><br>\n<div style=\"background-color:white;border-radius:10px;display: inline-block;\nmargin: 10px;padding:20px;text-align:left;font-size:15px;\">\nHola " . $r_user['nombre'] . ", la contraseña nueva para tu cuenta es:<br><br>\n<b>" . $_POST['pass'] . "</b><br><br>\nYa puedes entrar con ella:<a href=\"http://" . Sitio_direccion . "/login.php\">\nhttp://" . Sitio_direccion . "/login.php</a><br>\n<center><i style=\"font-size:12px; color: grey;\">" . Sitio . " (c)</i></center>\n</div>\n</body></html>";
$email_state = email_send($destinatario_name, $destinatario_email, $titulo, $mensaje);
if ($email_state != TRUE) {
print "<div class='centrar'><div class='error_ajustable'>Se ha producido un error al enviar el correo</div></div>";
}
die;
// Cambio pass fail
} else {
print "<div class='centrar'><div class='error_ajustable'>Se ha producido un error al cambiar la contraseña</div></div>";
}
}
}
?>
Si has perdido tu contraseña puedes generar otra introduciendo tu email a continuacion,<br>
la nueva contraseña se enviara a tu correo electronico.<br><br>
<form method='POST' action='otros.php'>
示例12: users_send_password_reset_code
function users_send_password_reset_code(&$user)
{
$code = users_generate_password_reset_code($user);
if (!$code) {
return 0;
}
$GLOBALS['smarty']->assign('code', $code);
email_send(array('to_email' => $user['email'], 'template' => 'email_password_reset.txt'));
return 1;
}
示例13: sql_query
$sql = sql_query(" SELECT id FROM `users` WHERE email='{$email1}' LIMIT 1 ");
if (sql_count($sql) > 0) {
notices_set('Email already in use, please use a different email or reset your password', 'error');
$terror = true;
}
//last error check
if ($terror) {
//exit script
echo notices_get();
return false;
}
//create password
$hash_token = password_hash_create();
//creates a users unique hash
$password = password_encrypt($password1, $hash_token);
//create account confirm
$confirm = confirm_token_create($email1);
//add to database
sql_query(" INSERT INTO `users` (hash_token, email, password, confirm) VALUES('{$hash_token}', '{$email1}', '{$password}', '{$confirm}') ");
//set notices
notices_set('Account successfully created!', 'success');
//send email
email_send('register', 'Welcome to Planling!', array($email1 => $email1), array('{{%LINK%}}' => 'http://' . MAIN_URL . '/verify?e=' . $email1 . '&t=' . $confirm));
//log the user in
if (do_login($email1, $password1)) {
$main_data = set_main_data();
} else {
return false;
}
//success
return true;
示例14: emailLinkToExecPlanning
/**
* Send link with filters to access (after login)
* to testCaseAssignedToMe feature
*
*/
function emailLinkToExecPlanning($context, $targetUsers = null)
{
$debugMsg = 'Class:' . __CLASS__ . ' - Method: ' . __FUNCTION__;
if (is_null($targetUsers)) {
$sql = "/* {$debugMsg} */ " . " SELECT id FROM {$this->tables['users']} ";
$targetUsers = $this->db->fetchColumnsIntoArray($sql, 'id');
}
$uSet = (array) $targetUsers;
// if user has at least 1 assignment in context
// send link
$atd = $this->get_available_types();
$tplan_id = intval($context['tplan_id']);
$build_id = intval($context['build_id']);
$sql = "/* {$debugMsg} */ " . " SELECT UA.user_id, U.email " . " FROM {$this->tables['user_assignments']} UA " . " JOIN {$this->tables['builds']} B " . " ON UA.build_id = B.id " . " LEFT JOIN {$this->tables['users']} U " . " ON U.id = UA.user_id " . " WHERE B.testplan_id = " . $tplan_id . " AND B.id = " . $build_id . " AND type = " . intval($atd['testcase_execution']['id']);
$rs = $this->db->fetchRowsIntoMap($sql, 'user_id');
$bye = true;
if (!is_null($rs) && count($rs) > 0) {
$bye = false;
$sql = " SELECT NHTPRJ.name AS tproject, " . " NHTPL.name AS tplan " . " FROM {$this->tables['nodes_hierarchy']} NHTPRJ " . " JOIN {$this->tables['nodes_hierarchy']} NHTPL " . " ON NHTPRJ.id = NHTPL.parent_id " . " JOIN {$this->tables['node_types']} NT " . " ON NHTPRJ.node_type_id = NT.id " . " WHERE NT.description = 'testproject' " . " AND NHTPL.id = " . $tplan_id;
$names = $this->db->get_recordset($sql);
$names = $names[0];
$body_flines = lang_get('testproject') . ': ' . $names['tproject'] . '<br />' . lang_get('testplan') . ': ' . $names['tplan'] . '<br /><br />';
}
if ($bye) {
return;
// >>>----> Bye,Bye!!!
}
$email = array();
$email['from_address'] = config_get('from_email');
$isoTS = date(DATE_RFC1123);
$genby = lang_get('generated_by_TestLink_on') . ' ' . $isoTS;
$ll = lang_get('mail_subject_link_to_assigned');
$email['subject'] = sprintf($ll, $names['tplan'], $isoTS);
$ln = $_SESSION['basehref'] . 'ltx.php?item=xta2m&tplan_id=' . $tplan_id . '&user_id=';
$hint = lang_get('hint_you_need_to_be_logged');
require_once 'email_api.php';
foreach ($uSet as $user_id) {
if (isset($rs[$user_id])) {
$email['to_address'] = trim($rs[$user_id]['email']);
if ($email['to_address'] != '') {
$email['body'] = $body_flines;
$email['body'] .= $hint . '<br><br>' . $ln . $user_id;
$email['body'] .= '<br><br>' . $genby;
$eop = email_send($email['from_address'], $email['to_address'], $email['subject'], $email['body'], '', true, true);
}
}
}
}
示例15: resetPassword
/**
* reset user password in DB
*
* @param resource &$db reference to database handler
* @param integer $userID
* @param string $newPasswordSendMethod, default 'send_password_by_mail'
*
* @return hash
* status: integer result status code
* password: new password
* msg: error message (if any)
*/
function resetPassword(&$db, $userID, $passwordSendMethod = 'send_password_by_mail')
{
$retval = array('status' => tl::OK, 'password' => '', 'msg' => '');
$user = new tlUser($userID);
$retval['status'] = $user->readFromDB($db);
// Reset can be done ONLY if user authentication method allows it.
$doIt = false;
if ($retval['status'] >= tl::OK) {
$cfg = config_get('authentication');
$cfg = $cfg['domain'];
$doIt = isset($cfg[$user->authentication]) && $cfg[$user->authentication]['allowPasswordManagement'];
}
if ($doIt) {
$retval['status'] = tlUser::E_EMAILLENGTH;
if (trim($user->emailAddress) != "") {
$newPassword = tlUser::generatePassword(8, 4);
$retval['status'] = $user->setPassword($newPassword, $cfg[$user->authentication]);
if ($retval['status'] >= tl::OK) {
$retval['password'] = $newPassword;
$mail_op = new stdClass();
$mail_op->status_ok = false;
if ($passwordSendMethod == 'send_password_by_mail') {
$msgBody = lang_get('your_password_is') . "\n\n" . $newPassword . "\n\n" . lang_get('contact_admin');
$mail_op = @email_send(config_get('from_email'), $user->emailAddress, lang_get('mail_passwd_subject'), $msgBody);
}
if ($mail_op->status_ok || $passwordSendMethod == 'display_on_screen') {
$retval['status'] = $user->writePasswordToDB($db);
} else {
$retval['status'] = tl::ERROR;
$retval['msg'] = $mail_op->msg;
}
}
}
}
$retval['msg'] = $retval['msg'] != "" ? $retval['msg'] : getUserErrorMessage($retval['status']);
return $retval;
}