本文整理汇总了PHP中sendmail函数的典型用法代码示例。如果您正苦于以下问题:PHP sendmail函数的具体用法?PHP sendmail怎么用?PHP sendmail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sendmail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: output_onpost_form_contact
function output_onpost_form_contact()
{
global $construct, $main, $db, $lang;
$main->header->hide = TRUE;
$main->menu->hide = TRUE;
$main->footer->hide = TRUE;
$from = $db->get('username, email', 'users', "id = '" . $main->userdata->user . "'");
$to_db = $db->get('email', 'users INNER JOIN users_nodes ON users_nodes.user_id = users.id', "users_nodes.node_id = " . intval(get('node')) . ($_POST['email_to_type'] == 'owner' ? " AND users_nodes.owner = 'Y'" : ""));
$node = $db->get('name, id', 'nodes', "id = " . intval(get('node')));
$to = array();
for ($i = 0; $i < count($to_db); $i++) {
array_push($to, $to_db[$i]['email']);
}
$to = implode(', ', $to);
$subject = $lang['email']['node_contact']['subject_prefix'] . stripslashes($_POST['email_subject']) . $lang['email']['node_contact']['subject_suffix'];
$body = $lang['email']['node_contact']['body_prefix'] . stripslashes($_POST['email_body']) . $lang['email']['node_contact']['body_suffix'];
$body = str_replace("##username##", $from[0]['username'], $body);
$body = str_replace("##node_name##", $node[0]['name'], $body);
$body = str_replace("##node_id##", $node[0]['id'], $body);
$ret = @sendmail($to, $subject, $body, $from[0]['username'], $from[0]['email'], TRUE);
if ($ret) {
$main->message->set_fromlang('info', 'message_sent');
} else {
$main->message->set_fromlang('error', 'generic');
}
}
示例2: addmail
function addmail($nom, $fnom, $lnom, $tel, $mail, $service)
{
// $arrayVariable["column name"] = formatted SQL value
global $db;
$mdp = ChaineAleatoire(8);
$values["pseudo"] = MySQL::SQLValue($nom);
$values["mail"] = MySQL::SQLValue($mail);
$values["tel"] = MySQL::SQLValue($tel);
$values["fonction"] = MySQL::SQLValue($service);
$values["nom"] = MySQL::SQLValue($fnom);
$values["prenom"] = MySQL::SQLValue($lnom);
$values["mdp"] = MySQL::SQLValue($mdp);
// Execute the insert
$result = $db->InsertRow("mail", $values);
// If we have an error
if (createmail($nom, $mdp)) {
if (!$result) {
$db->Kill($result);
return false;
} else {
// createmail($nom,$mdp);
sendmail($fnom, $mail, $nom, $mdp, $lnom);
return true;
}
} else {
return false;
}
}
示例3: addAction
function addAction()
{
if (POST) {
$uTw = array();
$uid = decode($_REQUEST['id']);
$this->scrap->Add(array("scrap" => $_REQUEST['scrap'], "privacy" => $_REQUEST['privacy'], "uid" => $uid));
$uT = $this->scrap->Get(0, 1, $uid);
$uT = $uT[0];
$privacy = $_REQUEST['privacy'] == 'Y' ? ' private ' : '';
if ($uid != $this->session->user['id']) {
$scrapTo = new UsersModel($uid);
$scrapTo = $scrapTo->Info();
$scrapBy = new UsersModel($this->session->user['id']);
$scrapBy = $scrapBy->Info();
$msg = "Hello " . $scrapTo['fname'] . " " . $scrapTo['lname'] . ",<br />\r\n\t\t\t\t\t\t<a href='" . WWW_ROOT . "user/" . encode($scrapBy["id"]) . "'>" . $scrapBy["fname"] . " " . $scrapBy["lname"] . "</a> just send a {$privacy} scrap to you,<br /><br />\r\n\t\t\t\t\t\t<strong style='font-size:16px'>" . $uT['scrap'] . "</strong><br /><br />\r\n\t\t\t\t\t\tto make reply or read more got to <a href='" . WWW_ROOT . "'>Pepool</a>.\r\n\t\t\t\t\t\t<br /><br />Thanks<br /><a href='" . WWW_ROOT . "'>Pepool.com</a>";
sendmail($scrapBy["fname"] . " " . $scrapBy["lname"] . " just send {$privacy} scrap to you..", $msg, $scrapTo['email'], $scrapTo['fname'] . ' ' . $scrapTo['lname']);
}
$uT["timestamps"] = timeDiff(strtotime($uT["timestamps"]));
$uT["id"] = encode($uT["id"]);
$uT["uid"] = encode($uT["uid"]);
$uT["scrap"] = str($uT["scrap"]);
$uT["privacy"] = $uT["privacy"];
$uT["d"] = true;
$uT["r"] = false;
die(json_encode($uT));
}
die;
}
示例4: index
function index()
{
$data['title'] = lang('lienhe');
$data['rs'] = $this->contact->get_contact();
$data['val'] = $this->contact->get_l_contact($this->lang_id);
$this->form_validation->set_rules('vdata[fullname]', 'Họ tên', 'required');
$this->form_validation->set_rules('vdata[email]', 'Email', 'required');
$this->form_validation->set_rules('vdata[title]', 'Tiêu đề', 'required');
$this->form_validation->set_rules('vdata[content]', 'Nội dung', 'required');
if ($this->form_validation->run() === FALSE) {
$this->pre_message = validation_errors();
} else {
$vdata = $this->request->post['vdata'];
$vdata['datesend'] = time();
if ($this->db->insert('contact', $vdata)) {
$send = $data['rs']->send_mail;
if ($send == 1) {
$this->load->helper('mail');
$to = $data['rs']->email;
$name = $vdata['fullname'];
$form = $vdata['email'];
$subject = $vdata['title'];
$message = "<h3>Nội dung liên hệ:</h3></br>";
$message .= $vdata['content'];
sendmail($name, $form, $to, $subject, $message);
}
$this->session->set_flashdata('message', lang('guithanhcong'));
redirect(uri_string());
} else {
$this->pre_message = lang('guikhongthanhcong');
}
}
$data['message'] = $this->pre_message;
$this->load->templates('index', $data);
}
示例5: set_staff_max
public function set_staff_max()
{
if (isset($_GET['max'])) {
$staff_max_data['max'] = $_GET['max'];
} else {
$staff_max_data['max'] = 2;
}
$a = M('staff');
$staff_map['status'] = 0;
$b = $a->where($staff_map)->select();
foreach ($b as $k => $v) {
if ($v['max'] != $staff_max_data['max']) {
$staff_set['staff_id'] = $v['staff_id'];
$c = $a->where($staff_set)->save($staff_max_data);
dump($c);
if (!$c) {
sendmail('staff_max set error.' . date("Y-m-d H:i"), 'error', '164773165@qq.com');
return false;
exit;
}
}
}
echo 'success';
return true;
}
示例6: mailRequest
/**
* Parse request build structure and send to admin
*/
public function mailRequest($data, $detail)
{
// dd($data);
$client = $detail['clientid'];
$this->transaction = $detail['transactionid'];
extract($data);
if (empty($requestid)) {
die('empty request');
}
$this->appendclient($client);
$requestid = array_filter($requestid);
foreach ($requestid as $key => $request) {
$this->process($key, $request);
}
$this->close();
$this->subject = 'New Request From ANASTAT Platform (' . date('D m Y h:i:s') . ')';
$this->notice = "<br> <b style='color:red'>NOTE :</b> You can always check your requests on our platform using your submission code";
//Send client a copy
if (!empty($this->ClientEmail)) {
sendmail($this->ClientEmail, 'ANASTAT PLATFORM', $this->subject, $this->table . $this->notice);
}
//Send admin a copy
if (!empty(config('site-email'))) {
sendmail(config('site-email'), 'ANASTAT PLATFORM', $this->subject, $this->table);
}
/*
* If client is affiliate : send manager an email
* Hide submission code from affiliate
*/
$this->table = str_replace($this->transaction, '###########', $this->table);
if (!empty($this->AffiliateEmail)) {
sendmail($this->AffiliateEmail, 'ANASTAT PLATFORM', $this->subject, $this->table);
}
}
示例7: parse_group
function parse_group($gid)
{
global $conn;
global $mailobj;
$sql = "SELECT id,active,sendday FROM `blog_article` where `active`=1 and `gid`={$gid}";
$rs =& $conn->Execute($sql);
$article_list = $rs->getArray();
//print_r($article_list);
$sql = "SELECT * FROM `subscription_user` where `active`=1 and `user_disable`=0 and `gid`={$gid}";
$rs =& $conn->Execute($sql);
$user_list = $rs->getArray();
//print_r($user_list);
$current = time();
for ($i = 0; $i < count($article_list); $i++) {
$afterday = $article_list[$i]["sendday"];
for ($j = 0; $j < count($user_list); $j++) {
$activetime = $user_list[$j]["activedate"];
$activetime = strtotime($activetime);
//轉成unix 時間
//echo strtotime($activetime); echo "<br>";
//echo ($current - $activetime) ;
//echo ("<br>");
//echo ($afterday *24*60*60);
//echo ("<br>");
if ($current - $activetime >= $afterday * 24 * 60 * 60 && alreaySent($user_list[$j]["Email"], $article_list[$i]["id"]) == false) {
sendmail($user_list[$j]["Email"], $article_list[$i]["id"], $user_list[$j]["name"], $user_list[$j]["md5"], $gid);
break;
}
}
}
}
示例8: sms_board_handle
function sms_board_handle($c_uid, $sms_datetime, $sms_sender, $sms_receiver, $board_keyword, $board_param = '')
{
global $web_title, $email_service, $email_footer, $gateway_module, $datetime_now;
$ok = false;
if ($sms_sender && $board_keyword && $board_param) {
// masked sender sets here
$masked_sender = substr_replace($sms_sender, 'xxxx', -4);
$db_query = "\n\t INSERT INTO " . _DB_PREF_ . "_featureBoard_log \n\t (in_gateway,in_sender,in_masked,in_keyword,in_msg,in_datetime) \n\t VALUES ('{$gateway_module}','{$sms_sender}','{$masked_sender}','{$board_keyword}','{$board_param}','{$datetime_now}')\n\t";
if ($cek_ok = @dba_insert_id($db_query)) {
$db_query1 = "SELECT board_forward_email FROM " . _DB_PREF_ . "_featureBoard WHERE board_keyword='{$board_keyword}'";
$db_result1 = dba_query($db_query1);
$db_row1 = dba_fetch_array($db_result1);
$email = $db_row1['board_forward_email'];
if ($email) {
// get name from c_uid's phonebook
$c_username = uid2username($c_uid);
$c_name = phonebook_number2name($sms_sender, $c_username);
$sms_sender = $c_name ? $c_name . ' <' . $sms_sender . '>' : $sms_sender;
$subject = "[SMSGW-" . $board_keyword . "] " . _('from') . " {$sms_sender}";
$body = _('Forward WebSMS') . " ({$web_title})\n\n";
$body .= _('Date and time') . ": {$sms_datetime}\n";
$body .= _('Sender') . ": {$sms_sender}\n";
$body .= _('Receiver') . ": {$sms_receiver}\n";
$body .= _('Keyword') . ": {$board_keyword}\n\n";
$body .= _('Message') . ":\n{$board_param}\n\n";
$body .= $email_footer . "\n\n";
sendmail($email_service, $email, $subject, $body);
}
$ok = true;
}
}
return $ok;
}
示例9: output_onpost_form_restore
function output_onpost_form_restore()
{
global $main, $db, $vars, $lang;
$t = $db->get('id, account_code', 'users', "username = '" . $_POST['users__username'] . "' AND email = '" . $_POST['users__email'] . "'");
if ($t[0]['id'] != '') {
if ($t[0]['account_code'] == '') {
$t[0]['account_code'] = generate_account_code();
$data['account_code'] = $t[0]['account_code'];
$db->set('users', $data, "id = '" . $t[0]['id'] . "'");
}
$subject = $lang['email']['user_restore']['subject'];
$subject = str_replace('##username##', $_POST['users__username'], $subject);
$body = $lang['email']['user_restore']['body'];
$body = str_replace('##username##', $_POST['users__username'], $body);
$body = str_replace('##act_link##', $vars['site']['url'] . "?page=users&user=" . $t[0]['id'] . "&action=restore&account_code=" . $t[0]['account_code'], $body);
$ret = sendmail($_POST['users__email'], $subject, $body);
if ($ret) {
$main->message->set_fromlang('info', 'restore_success');
} else {
$main->message->set_fromlang('error', 'generic');
}
} else {
$main->message->set_fromlang('error', 'login_failed');
}
}
示例10: registerUser
function registerUser($post)
{
$name = $post['firstName'] . ' ' . $post['lastName'];
$query = "insert into user set fullName='" . $name . "',\n email='" . $post['email'] . "', password='" . $post['password'] . "' ,\n gender='" . $post['gender'] . "',\n contactNumber='" . $post['contactNumber'] . "',\n address='" . $post['address'] . "',status= '0'";
$token = sha1(uniqid($_POST['email'], true));
$connection = connect();
$execute = $connection->query($query);
$tokenAccess = "insert into accessToken set\n token='" . $token . "', linkStatus= '0', tStamp=NOW() ,role= '0'";
$accessToken = $connection->query($tokenAccess);
sendmail($post['email'], $token);
}
示例11: public_test_mail
public function public_test_mail()
{
pc_base::load_sys_func('mail');
$subject = 'phpcms test mail';
$message = 'this is a test mail from phpcms team';
$mail = array('mailsend' => 2, 'maildelimiter' => 1, 'mailusername' => 1, 'server' => $_POST['mail_server'], 'port' => intval($_POST['mail_port']), 'mail_type' => intval($_POST['mail_type']), 'auth' => intval($_POST['mail_auth']), 'from' => $_POST['mail_from'], 'auth_username' => $_POST['mail_user'], 'auth_password' => $_POST['mail_password']);
if (sendmail($_GET['mail_to'], $subject, $message, $_POST['mail_from'], $mail)) {
echo L('test_email_succ') . $_GET['mail_to'];
} else {
echo L('test_email_faild');
}
}
示例12: fail
/**
* 更新账户有效状态
* @param string $type 第三方平台类型
*/
public function fail($third, $error_msg = NULL)
{
$pid = $third['pid'];
$type = $third['type'];
ob_start();
debug_print_backtrace();
$trace = ob_get_contents();
ob_clean();
Log::customLog('token_expires_error.txt', $this->rep_platform("Token 过期,平台:{pid}|{type}, {platform},{weibo},原因:{$error_msg}\r\n调用堆栈:\r\n{$trace}", $pid, $type));
$mail = Config::get_mail('token_expire');
sendmail($mail['to'], $this->rep_platform($mail['subject'], $pid, $type), $this->rep_platform($mail['content'], $pid, $type) . "<br>原因:{$error_msg}");
return $this->update(array('valid' => 0), array('pid' => $pid, 'type' => $type));
}
示例13: upload
function upload($user_name, $email, $message, $file)
{
global $dbstamian;
if (empty($user_name)) {
echo 'Sorry Username empty';
} elseif (empty($email)) {
echo 'Sorry Email empty';
} elseif (empty($message)) {
echo 'Sorry Message empty';
} elseif (empty($file)) {
echo 'Sorry File Empty';
} elseif ($file['file_attach']['size'] > 41943040) {
echo 'Sorry File limit 40 MB';
} else {
$file_dir = 'file/';
$file_name = rand(00, 9999) . "_" . ereg_replace('[[:space:]]+', '_', trim(addslashes(strip_tags($file['file_attach']['name']))));
$file_size = $file['file_attach']['size'];
$file_tmp = $file['file_attach']['tmp_name'];
$file_type = $file['file_attach']['type'];
$file_ext = strtolower(end(explode('.', $file_name)));
$regex = "/^([0-9])+_?([0-9a-zA-Z\\_\\-]+).{1}(jpeg|jpg|png|pdf|doc|docx)+/";
$match = preg_match($regex, $file_name);
$file_allow = array("jpeg", "jpg", "png", "pdf", "doc", "docx");
$mim_type = array("image/jpeg", "image/jpg", "image/png", "application/pdf", "application/doc", "application/docx");
if (in_array($file_ext, $file_allow) === true and in_array($file_type, $mim_type) === true and !file_exists($file_dir, $file_name) and checkemail($email) == true and $match == true) {
$sql = "INSERT INTO contact(contact.contact_name,contact.contact_email,contact.contact_file,contact.contact_date,contact.contact_message) VALUES('" . $user_name . "','" . $email . "','" . $file_name . "',NOW(),'" . $message . "')";
$result = mysql_query($sql, $dbstamian);
mysql_insert_id();
$send = sendmail($user_name, $email, $message, $file_name, $file_tmp, $file_size, $file_type);
if (!$result and !$send) {
echo 'Echec de telechargement, Meri de renvoyer votre fichier';
} else {
if ($file['file_attach']['error'] == 1) {
echo 'file upload max file size over limit php.ini';
} elseif ($file['file_attach']['error'] == 2) {
echo 'File Max_file_SIZE for form';
} elseif ($file['file_attach']['error'] == 3) {
echo 'upload file not a connect server';
} elseif ($file['file_attach']['error'] == 4) {
echo 'Not a file';
} elseif ($file['file_attach']['error'] == 0) {
@move_uploaded_file($file_tmp, $file_dir . $file_name);
echo "Merci votre fichier a été envoyé";
}
}
} else {
echo 'Echec, votre fichier doit etre au format pdf';
}
}
}
示例14: loadBackOfficeUser
public function loadBackOfficeUser()
{
$error = '';
$succes = '';
if (!empty($_POST)) {
if (isset($_POST['modifieruser'])) {
$verificationPhoto = new Verification($_FILES);
if (!empty($_FILES['photo']['name'])) {
$verificationPhoto->PhotoOk('photo', $_POST['pseudouser'] . '.jpg', 'Users/Profil', false);
}
if (!empty($_FILES['couverture']['name'])) {
$verificationPhoto->PhotoOk('couverture', $_POST['pseudouser'] . '.jpg', 'Users/Bannière', false);
}
$error .= $verificationPhoto->error;
if (!empty($_FILES['photo']['name'])) {
$error .= deletePhoto($_POST['pseudouser'] . '.jpg', 'Users/Profil', 'Erreur de suppression du champ photo.');
}
if (!empty($_FILES['couverture']['name'])) {
$error .= deletePhoto($_POST['pseudouser'] . '.jpg', 'Users/Bannière', 'Erreur de suppression du champ photo.');
}
$error .= uploadPhoto($_POST['pseudouser'] . '.jpg', 'Users/Profil', 'photo');
$error .= uploadPhoto($_POST['pseudouser'] . '.jpg', 'Users/Bannière', 'couverture');
if (empty($error)) {
$this->admin->updateUser($_POST['id_user']);
$succes = "Modification effectuée!";
}
}
if (isset($_POST['SupprUser'])) {
$this->admin->deleteUser($_POST['id_user']);
$succes = "Utilisateur supprimé avec succès!";
}
if (isset($_POST['Ban'])) {
$this->admin->BanUser($_POST['id_user']);
$succes = "Utilisateur banni avec succès!";
$user = $this->user->getDataUserById($_POST['id_user'])->fetchAll();
sendmail($user[0], 'Bannissement du compte.', 'banned.php');
}
if (isset($_POST['unBan'])) {
$this->admin->UnBanUser($_POST['id_user']);
$succes = "Utilisateur unban avec succès!";
$user = $this->user->getDataUserById($_POST['id_user'])->fetchAll();
sendmail($user[0], 'Unban du compte.', 'unbanned.php');
}
}
$users = $this->user->getDataUsers()->fetchAll();
$nbGroupeUsers = $this->user->getNbGroupeUsers($users);
$nbPostUsers = $this->user->getNbPostUsers($users);
$vue = new Vue("BackOfficeUtilisateur", "Admin", ['font-awesome.css', 'admin.css'], ['Admin/admin.js']);
$vue->loadbackoffice(['users' => $users, 'nbGroupeUsers' => $nbGroupeUsers, 'nbPostUsers' => $nbPostUsers, 'error' => $error, 'succes' => $succes]);
}
示例15: addAction
function addAction()
{
if ($this->tweet->Add($_REQUEST['tweet'])) {
$uT = $this->tweet->Current();
$user = $this->view->user;
$Friends = $this->user->GetFriends();
foreach ($Friends["friends"] as $friend) {
$msg = "Hello " . $friend['username'] . ",<br />\r\n\t\t <a href='" . WWW_ROOT . "user/" . encode($user["id"]) . "'>" . $user["fname"] . " " . $user["lname"] . "</a> tweets:<br /><br />\r\n\t\t\r\n\t\t<strong style='font-size:16px'>" . $uT["tweet"] . "</strong><br /><br />\r\n\t\tto view more more what " . ($user["gender"] == 'M' ? 'he' : 'she') . " says <a href='" . WWW_ROOT . "user/" . encode($user["id"]) . "'>click here</a>.\r\n\t\t<br /><br />Thanks<br /><a href='" . WWW_ROOT . "'>Pepool.com</a>";
sendmail($user["fname"] . " " . $user["lname"] . " tweets..", $msg, $friend['email'], $friend['username']);
}
$uT["timestamps"] = timeDiff(strtotime($uT["timestamps"]));
$uT["id"] = encode($uT["id"]);
$uT["uid"] = encode($uT["uid"]);
jencode($uT);
}
}