本文整理汇总了PHP中Customers::findbyemail方法的典型用法代码示例。如果您正苦于以下问题:PHP Customers::findbyemail方法的具体用法?PHP Customers::findbyemail怎么用?PHP Customers::findbyemail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Customers
的用法示例。
在下文中一共展示了Customers::findbyemail方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: passwordAction
public function passwordAction()
{
$request = $this->getRequest();
$translator = Shineisp_Registry::getInstance()->Zend_Translate;
if ($request->isPost()) {
$email = $request->getParam('account');
$customer = Customers::findbyemail($email, "email, password, language_id", true);
if (isset($customer[0]) && is_numeric($customer[0]['customer_id'])) {
// generate key
$resetKey = Customers::generateResetPasswordKey($customer[0]['customer_id']);
}
if (count($customer) > 0 && !empty($resetKey)) {
Shineisp_Commons_Utilities::sendEmailTemplate($customer[0]['email'], 'password_reset_link', array('link' => "http://" . $_SERVER['HTTP_HOST'] . "/index/resetpwd/id/" . $resetKey, ':shineisp:' => $customer), null, null, null, null, $customer[0]['language_id']);
$this->view->mextype = "success";
$this->view->mex = $translator->translate('Your password has been sent. Please click on the link contained in the email.');
} else {
$this->view->mextype = "alert";
$this->view->mex = $translator->translate('User not found. Please check your credentials.');
}
}
return $this->_helper->viewRenderer('password');
}
示例2: SendEmail
//.........这里部分代码省略.........
$zend_attachment->filename = $filename;
$mail->addAttachment($zend_attachment);
}
}
} else {
if (file_exists($attachments)) {
$filename = basename($attachments);
// Get the content of the file
$content = file_get_contents($attachments);
// Create the attachment
$zend_attachment = new Zend_Mime_Part($content);
$zend_attachment->disposition = Zend_Mime::DISPOSITION_ATTACHMENT;
$zend_attachment->encoding = Zend_Mime::ENCODING_BASE64;
$zend_attachment->filename = $filename;
$mail->addAttachment($zend_attachment);
}
}
}
if (!empty($inreplyto)) {
$mail->addHeader("In-Reply-To", $inreplyto);
}
if (!empty($replyto)) {
$mail->setReplyTo($replyto);
}
// If the body of the message contains the HTML tags
// we have to override the $html variable in order to send the html message by email
if (self::isHtml($body)) {
$html = true;
}
if ($html) {
$mail->setBodyHtml($body, null, Zend_Mime::ENCODING_8BIT);
} else {
$mail->setBodyText($body);
}
if (is_array($from)) {
$mail->setFrom($from['email'], $from['name']);
} else {
$mail->setFrom($from);
}
// If the $to is a group of emails addresses
if (is_array($to)) {
foreach ($to as $recipient) {
$mail->addTo($recipient);
}
} else {
$mail->addTo($to);
}
if (!empty($bcc)) {
if (is_array($bcc) && count($bcc) > 0) {
foreach ($bcc as $b) {
$mail->addBcc($b);
}
} else {
$mail->addBcc($bcc);
}
}
if (!empty($cc)) {
if (is_array($cc) && count($cc) > 0) {
foreach ($cc as $c) {
$mail->addCc($c);
}
} else {
$mail->addCc($cc);
}
}
$mail->setSubject($subject);
try {
$mail->send($transport);
// All good, log to DB
if (is_array($to)) {
foreach ($to as $recipient) {
// get customer_id
$Customers = Customers::findbyemail($recipient);
if (is_object($Customers) && is_object($Customers->{0}) && isset($Customers->{0}->customer_id)) {
$customerId = $Customers->{0}->customer_id;
}
if (EmailsTemplatesSends::saveIt($customerId, $from, $recipient, $subject, $cc, $bcc, $html, $body)) {
Shineisp_Commons_Utilities::log("An email has been sent to {$recipient}", 'notice.log');
// log the data
}
}
} else {
// get customer_id
$Customers = Customers::findbyemail($to);
if (is_object($Customers) && is_object($Customers->{0}) && isset($Customers->{0}->customer_id)) {
$customerId = $Customers->{0}->customer_id;
}
if (EmailsTemplatesSends::saveIt($customerId, $from, $to, $subject, $cc, $bcc, $html, $body)) {
Shineisp_Commons_Utilities::log("An email has been sent to {$to}", 'notice.log');
// log the data
}
}
return true;
} catch (Exception $e) {
// log the data
Shineisp_Commons_Utilities::log($e->getMessage());
return array('email' => $to, 'message' => $e->getMessage());
}
return false;
}