本文整理汇总了PHP中Email::sendMail方法的典型用法代码示例。如果您正苦于以下问题:PHP Email::sendMail方法的具体用法?PHP Email::sendMail怎么用?PHP Email::sendMail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Email
的用法示例。
在下文中一共展示了Email::sendMail方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sentContactEmail
public static function sentContactEmail($formData, $postingData, $isLog = true)
{
$mail_subject = str_replace('[Sender]', $formData["fullname"], self::CONTACTEMAILSUBJECT);
$mail_subject = str_replace('[Label]', $postingData["questionlabel"], $mail_subject);
$mail_body = TemplatingManager::getContactEmail($formData, $postingData);
Email::sendMail($postingData["email_to"], $formData["fullname"], $mail_subject, $mail_body);
$emaillog = new Emaillog();
$emaillog->writelog($postingData["id"], $formData["fullname"], $formData["email_from"], $formData["question"]);
}
示例2: email_send
public static function email_send(\ApiParam $params)
{
if (!$params->to) {
throw new \Exception('Email target required!', 501);
}
if (!\Email::isValidEmail($params->to)) {
throw new \Exception('Email target invalid!', 502);
}
if (!$params->subject) {
throw new \Exception('Email subject required!', 503);
}
if (!$params->body) {
throw new \Exception('Email content required!', 504);
}
if ($params->from && !\Email::isValidEmail($params->from)) {
throw new \Exception('Email source invalid', 505);
}
return (bool) \Email::sendMail($params->to, $params->subject, $params->body, $params->from, $params->fromAlias);
}
示例3: actionTeskirim
public function actionTeskirim()
{
Email::sendMail('teguh@andromedia.co.id', 'Coba Kirim PHP', 'Ini tes kirim pake PHP');
Yii::app()->nfy->send(array('url' => Yii::app()->controller->createUrl('/dev/forms/index'), 'message' => "Tes kirim Notif", 'notes' => "Tes Notif", 'to' => array('role' => 'dev')));
echo 'Oke';
}
示例4: array
<?php
require 'email/PHPMailerAutoload.php';
require 'email.php';
$mapEmails = array(array('name' => 'Joe Doe', 'email' => 'joedoe@email.com'), array('name' => 'Cool Many', 'email' => 'coolmany@email.com'), array('name' => 'Juan Perez', 'email' => 'juanperez@email.com'), array('name' => 'Max Power', 'email' => 'maxpower@email.com'), array('name' => 'Laura Doe', 'email' => 'lauradoe@email.com'));
shuffle($mapEmails);
shuffle($mapEmails);
shuffle($mapEmails);
$sSubject = '! Santa Secreto de:...';
$total = count($mapEmails);
echo $total . '<br>' . PHP_EOL;
for ($i = 0; $i < $total; $i++) {
$dude = $mapEmails[$i]['name'];
$dudeMail = $mapEmails[$i]['email'];
if ($i + 1 !== $total) {
$selectedFriend = $mapEmails[$i + 1]['name'];
} else {
$selectedFriend = $mapEmails[0]['name'];
}
$mail = new Email();
// $emailSent = $mail->sendMail('luar007@gmail.com', $sSubject, 'default', $params = array('from'=>$dude,'to'=>$selectedFriend));
$emailSent = $mail->sendMail($dudeMail, $sSubject, 'default', $params = array('from' => $dude, 'to' => $selectedFriend));
if ($emailSent !== true) {
die(var_dump($emailSent));
} else {
echo 'email success: ' . $i . ' <br> ' . PHP_EOL;
}
}
示例5: submitNewUser
static function submitNewUser($username, $password, $email, $password2 = null)
{
if (!registerUsers()) {
return 5;
}
// admin has disabled registering new users
$email = filter_var($email, FILTER_SANITIZE_EMAIL);
$username = validateUserName($username) ? $username : false;
$password = validatePassword($password) ? $password : false;
if (!$username || !$password) {
return 1;
// username or password does not meet the requirements
}
if (isset($password2)) {
$password2 = validatePassword($password2) ? $password2 : false;
if ($password2 != false) {
//$password2 = passwordHash($password2);
if ($password2 != $password) {
return 4;
// passwords do not match
}
} else {
return 4;
}
}
$password = passwordHash($password);
$current_datetime = jDateTime::gdate('Y-m-d H:i:s');
if (Users::userExists($username)) {
return 2;
// username already exist
}
$activate = md5($email . time());
$conn = MySQL::open_conn();
$query = "INSERT INTO c_users (user_login, user_pass, user_email, user_registered, activate) ";
$query .= "VALUES ('{$username}', '{$password}', '{$email}', '{$current_datetime}', '{$activate}')";
$res = $conn->query($query);
if (!$res) {
return 3;
}
// unknown error while creating new user
$row = $conn->query("SELECT MAX(ID) AS max FROM c_users")->fetch_array();
if ($row) {
$id = $row['max'];
}
if (shouldConfMail()) {
$mail_content = replace_template(getDefaultEmailTemplateContent(), getConfEmailTemplateVars($id));
Email::sendMail($email, $username, getConfMailSubject(), $mail_content);
}
return 0;
}
示例6: Email
$bcc = "";
$subject = "Sample Mail";
$message = '<p>Mihi videtur, me et te
Sunt post aliquid, yeah.
Tibus scire quid hic?
Iniquum tibi videtur, et mihi
Obliti estis aliquid, Yeah,
Quod amor tam facile in oblivionem.</p>
<p>Fluunt et refluunt convertat rotam vita omnia
Est vere iustus a circuli.</p>';
// create object
include "Email.php";
$thisEmail = new Email($to, $cc, $bcc, $from, $subject, $message);
// send mail
$status = $thisEmail->sendMail($to, $cc, $bcc, $from, $subject, $message);
//display information to user
if ($status === true) {
print "<p>Mail has been sent to: ";
print $to;
print ". Print a copy for your records:</p>";
print $message;
} else {
// you may not need to use the else portion. It is here
// so you can see it
print '<p class="erorr">Your email has the following mistake';
if (count($status) > 1) {
print 's';
}
print '</p>';
print "<ol>";
示例7: sendText
public static function sendText($to, $subject, $msg, $anexos = array())
{
$email = new Email();
$email->to = $to;
$email->subject = $subject;
$email->format = 'text';
$email->setBody($msg);
$email->anexos = $anexos;
$email->message->embed = false;
$email->sendMail();
}
示例8: send
/**
* Send the mail.
*
* @param Email $mail
* @param boolean $throwException
* @return Recipe_Email_Template
*/
public function send(Email $mail, $throwException = true)
{
$mail->setMessages($this->getMessages());
$mail->sendMail($throwException);
return $this;
}
示例9: Form
require 'core.php';
$Form = new Form();
$Email = new Email();
if (!isset($_POST['submit'])) {
redirect('forgot_password.php');
} else {
if (!isset($_POST['email']) || empty($_POST['email'])) {
$Form->setError('email', 'Please write your email address');
}
if ($Form->num_errors > 0) {
$Form->return_msg_to('forgot_password.php');
} else {
$email = cleanData($_POST['email']);
$user = mysql_fetch_assoc(mysql_query('SELECT * FROM ' . TBL_USER . ' WHERE email="' . $email . '"'));
if (!$user) {
$Form->setError('notFound', 'User Not Found.');
$Form->return_msg_to('forgot_password.php');
} else {
$Email->setEmailSubject('Forgot Password');
$Email->setMessage('Your password is ' . $user['password']);
$Email->setEmailTo($email);
if ($Email->sendMail()) {
$Form->setError('success', 'Your password has been sent to your email. Please check your mails.');
$Form->return_msg_to('forgot_password.php');
} else {
$Form->setError('notFound', 'User Not Found.');
$Form->return_msg_to('forgot_password.php');
}
}
}
}
示例10: cleanData
$Form->setError('leadsError', 'Please select call time and enter a phone number');
}
}
if ($Form->num_errors > 0) {
$Form->return_msg_to('view.php');
} else {
$first_name = cleanData($_POST['first_name']);
$last_name = cleanData($_POST['last_name']);
$lead_result = cleanData($_POST['lead_result']);
$call_time = cleanData($_POST['call_time']);
$phone_no = cleanData($_POST['phone_no']);
$notes = cleanData($_POST['notes']);
$leadAdd = insertQuery(TBL_LEADS, array('user_id' => $_SESSION['user_id'], 'first_name' => $first_name, 'last_name' => $last_name, 'lead_result' => $lead_result, 'call_time' => $call_time, 'phone_no' => $phone_no, 'notes' => $notes, 'create_date' => 'NOW()'));
if (!$leadAdd) {
$Form->setError('error', 'Database error! Please try again.');
$Form->return_msg_to('view.php');
} else {
if ($lead_result == 'Y') {
$leadData = mysql_fetch_object(mysql_query("SELECT agency.agency_name, leads.first_name, leads.last_name, leads.phone_no, leads.call_time, leads.notes FROM leads LEFT JOIN user ON user.id = leads.user_id LEFT JOIN agency ON agency.id = user.agency_id WHERE leads.id = {$leadAdd}"));
$Email->setEmailSubject('A new lead has been submitted.');
$Email->setMessage("A new lead has been submitted for agency <b>{$leadData->agency_name}</b> by <b style='color: #9B0202' >{$_SESSION->first_name} {$_SESSION->last_name}</b> with following info:<br/><br/>" . "<b style='color: #9B0202'>Lead :</b> <span style='color: #9B0202' > {$leadData->first_name} {$leadData->last_name} </span> <br/>" . "<b>Phone :</b> {$leadData->phone_no} <br/>" . "<b>Time to Call:</b> {$leadData->call_time} <br/>" . "<b>Note :</b> {$leadData->notes}. ");
$sentMailQuery = mysql_query("SELECT email FROM user WHERE type='admin' AND receive_email ='Y'");
while ($sentMail = mysql_fetch_assoc($sentMailQuery)) {
$Email->setEmailTo($sentMail['email']);
$Email->sendMail();
}
}
redirect('view.php?leads=success');
}
}
}