本文整理汇总了PHP中Mailer::send方法的典型用法代码示例。如果您正苦于以下问题:PHP Mailer::send方法的具体用法?PHP Mailer::send怎么用?PHP Mailer::send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mailer
的用法示例。
在下文中一共展示了Mailer::send方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendEmailOfNotification
/**
* Send a email with the password.
* @param $user
*/
protected function sendEmailOfNotification($user)
{
$this->mailer->send('jupiter::emails.password-notification', $user, function ($message) use($user) {
$message->from(config('jupiter.emails.from.email'), config('jupiter.emails.from.name'));
$message->to($user['email'], $user['name'])->subject('Welcome to our application.');
});
}
示例2: transportEmail
/**
* Transport a mail.
*
* @param string $strRecipientEmail
* @param Mail $email
*
* @return void
* @throws AvisotaTransportException
*/
public function transportEmail($recipient, Mail $email)
{
global $page;
try {
// set sender email
if ($this->config->sender) {
$email->setSender($this->config->sender);
} else {
if (isset($page) && strlen($page->adminEmail)) {
$email->setSender($page->adminEmail);
} else {
$email->setSender($GLOBALS['TL_CONFIG']['adminEmail']);
}
}
// set sender name
if (strlen($this->config->senderName)) {
$email->setSenderName($this->config->senderName);
}
// set reply email
if ($this->config->replyTo) {
$email->setReplyTo($this->config->replyTo);
}
// set reply name
if ($this->config->replyToName) {
$email->setReplyToName($this->config->replyToName);
}
$this->mailer->send($email, $recipient);
} catch (Swift_RfcComplianceException $e) {
throw new AvisotaTransportEmailException($recipient, $email, $e->getMessage(), $e->getCode(), $e);
}
}
示例3: executeRegistrationSubmit
public function executeRegistrationSubmit(sfWebRequest $request)
{
$this->forwardErrorIf($this->getUser()->isAuthenticated(), "User can not register if already logged in.");
$this->forward404Unless($request->isMethod('post'));
$this->form = new RegistrationForm();
$this->form->bind($request->getParameter('register'));
if ($this->form->isValid()) {
$account = $this->form->save();
$profile = new Profile();
$profile->uid = $account->id;
$profile->username = $account->username;
$profile->first_name = $request->getPostParameter('register[first_name]');
$profile->middle_name = $request->getPostParameter('register[middle_name]');
$profile->last_name = $request->getPostParameter('register[last_name]');
$profile->name = $profile->first_name . " " . $profile->middle_name . " " . $profile->last_name;
$profile->pic = "0.jpg";
$profile->save();
$mailer = new Mailer();
if ($mailer->send($account->email, sfConfig::get('app_registration_email_from_address'), sfConfig::get('app_site_name'), sfConfig::get('app_registration_email_subject'), " \nDear " . $profile->first_name . ",\n\n\nWelcome to " . sfConfig::get('app_site_name') . ". We are very pleased you decided to start the\nnext generation of your online social life with us! Below you will\nfind an activation link. Please click this link to verify your\naccount before logging in. If you have any trouble, please contact\nus via the \"Contact\" link on the home page of our web site.\n\n\nVERIFICATION LINK (Please click or paste into your browser address bar)\n-----------------------------------------------------------------------\n" . "http://rks.ath.cx:8080" . $this->generateUrl('verify') . '/id/' . $account->id . '/vid/' . md5($account->created_at) . "\n-----------------------------------------------------------------------\n\nIf you feel you were added to our system by mistake, please contact\nus via the \"Contact\" link on the home page of our web site.\n\n--The " . sfConfig::get('app_site_name') . " Support Team\n ")) {
$this->getUser()->setFlash('info', "Registration was successful, please check your email to verify your account");
$this->redirect('account/login');
} else {
$this->getUser()->setFlash('error', "Error occured sending with our mail server, please register again using a different username");
$this->redirect('account/register');
}
}
$this->setTemplate('register');
}
示例4: handle
/**
* handle user request
*/
function handle()
{
global $INPUT;
global $conf;
if (!$INPUT->bool('send')) {
return;
}
// make sure debugging is on;
$conf['plugin']['smtp']['debug'] = 1;
// send a mail
$mail = new Mailer();
if ($INPUT->str('to')) {
$mail->to($INPUT->str('to'));
}
if ($INPUT->str('cc')) {
$mail->to($INPUT->str('cc'));
}
if ($INPUT->str('bcc')) {
$mail->to($INPUT->str('bcc'));
}
$mail->subject('DokuWiki says hello');
$mail->setBody("Hi @USER@\n\nThis is a test from @DOKUWIKIURL@");
$ok = $mail->send();
// check result
if ($ok) {
msg('Message was sent. SMTP seems to work.', 1);
} else {
msg('Message wasn\'t sent. SMTP seems not to work properly.', -1);
}
}
示例5: handle
/**
* Execute the job.
*
* @return void
*/
public function handle(Mailer $mailer)
{
$mailer->send('mail.welcome', ['data' => 'data'], function ($message) {
$message->from('nwambachristian@gmail.com', 'Christian Nwmaba');
$message->to('nwambachristian@gmail.com');
});
}
示例6: mail_admins
function mail_admins($subject, $body, $attachments = array(), $options = array())
{
$settings = Project::currentProject()->getSettings();
$recipients = $settings['ADMINS'];
// TODO: Massage the recipients list format
Mailer::send($recipients, $subject, $body, $attachments, $options);
}
示例7: process
private function process()
{
$this->f3->scrub($_POST);
$audit = \Audit::instance();
$this->f3->set('SESSION.flash', array());
// validate form
if (!preg_match("/^[\\w\\- ]{2,30}\$/", $this->f3->get('POST.name'))) {
$this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid name.'));
}
if (!$audit->email($this->f3->get('POST.email'), FALSE)) {
$this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid email address'));
}
if (!empty($this->f3->get('POST.url')) && !$audit->url($this->f3->get('POST.url'))) {
$this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid URL.'));
}
if (empty($this->f3->get('POST.message'))) {
$this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Please include a message!'));
}
// honey pot
if ($this->f3->get('POST.username') !== '') {
$this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Please do not use autofill or similar tools!'));
}
// if there are no errors, process the form
if (count($this->f3->get('SESSION.flash')) === 0) {
$this->f3->set('POST.level', $this->f3->get('member')->level + 1);
$mailer = new Mailer();
$message = $mailer->message()->setSubject($this->f3->get('tcgname') . ': Contact Form')->setFrom(array($this->f3->get('noreplyemail') => 'MyTCG'))->setTo(array($this->f3->get('tcgemail')))->setReplyTo(array($this->f3->get('POST.email')))->setBody(Template::instance()->render('app/templates/emails/contact.htm'), 'text/html');
if ($mailer->send($message)) {
$this->f3->push('SESSION.flash', array('type' => 'success', 'msg' => 'Your form has been sent. Thanks for contacting us!'));
} else {
$this->f3->push('SESSION.flash', array('type' => 'danger', 'msg' => 'There was a problem processing your request. Please try again or contact us for assistance!'));
}
}
}
示例8: lostpass
public function lostpass()
{
if ($this->f3->exists('POST.lostpass')) {
$audit = \Audit::instance();
$this->f3->scrub($_POST);
$this->f3->set('SESSION.flash', array());
$members = new Members($this->db);
// validate form
if (!$audit->email($this->f3->get('POST.email'), FALSE)) {
$this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid email address'));
}
if ($members->count(array('email=?', $this->f3->get('POST.email'))) == 0) {
$this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Couldn\'t find an account associated with that email address.'));
}
if (count($this->f3->get('SESSION.flash')) === 0) {
// generate random password
$this->f3->set('password', md5(time()));
$this->f3->set('POST.password', password_hash($this->f3->get('password'), PASSWORD_DEFAULT));
$mailer = new Mailer();
$message = $mailer->message()->setSubject($this->f3->get('tcgname') . ': Password Reset')->setFrom(array($this->f3->get('noreplyemail') => $this->f3->get('tcgname')))->setTo(array($this->f3->get('POST.email')))->setReplyTo(array($this->f3->get('tcgemail')))->setBody(Template::instance()->render('app/templates/emails/pwreset.htm'), 'text/html');
// save new password and email to member
if ($members->edit($members->read(array('email=?', $this->f3->get('POST.email')), [])[0]->id, array('password')) && $mailer->send($message)) {
$this->f3->push('SESSION.flash', array('type' => 'success', 'msg' => 'Your password has been reset! Please check your email.'));
} else {
$this->f3->push('SESSION.flash', array('type' => 'danger', 'msg' => 'Password reset failed. Please try again or contact us for assistance.'));
}
}
}
$this->f3->set('content', 'app/views/lostpass.htm');
echo Template::instance()->render('app/templates/default.htm');
}
示例9: sandmailAction
function sandmailAction()
{
$firstnameErrText = "";
$lastnameErrText = "";
$addressErrText = "";
$exemplarsErrText = "";
if (empty($_POST['firstname'])) {
$firstnameErrText = "не ввели имя!";
}
if (empty($_POST['lastname'])) {
$lastnameErrText = "<span class=err> не ввели фамилию! </span> ";
}
if (empty($_POST['address'])) {
$addressErrText = "<span class=err> не ввели адрес! </span> ";
}
if (empty($_POST['exemplars'])) {
$exemplarsErrText = "<span class=err> не выбрано количество! </span> ";
}
if (!empty($_POST['firstname']) && !empty($_POST['lastname']) && !empty($_POST['address']) && !empty($_POST['exemplars'])) {
$body = $row['FIO'] . "\r\n" . $row['BookName'] . ", количество: " . $_POST["exemplars"] . "\r\n" . $_POST["firstname"] . " " . $_POST["lastname"] . " " . $_POST["address"];
$title = substr(htmlspecialchars(trim($_POST['lastname'])), 0, 1000) . " ";
$title .= substr(htmlspecialchars(trim($_POST['firstname'])), 0, 1000) . ", ";
$title .= "Адресс :" . substr(htmlspecialchars(trim($_POST['address'])), 0, 1000);
$to = 'admin@test.ru';
$sendaddress = mail($to, $title, 'Заказ:' . $body);
$mailer = new Mailer();
try {
$mailer->send($to, $title, 'Заказ:' . $body);
} catch (Exception $err) {
$sendaddressErr = true;
}
}
include_once 'views/sendmail.tpl';
}
示例10: InsertAndSendMail
public function InsertAndSendMail()
{
$quotedAuthor = trim($_POST['mail']);
$quotedTitle = trim($_POST['title']);
$isbn = Isbn::stringFromPost();
$year = (int) trim($_POST['year']);
$price = (double) str_replace(',', '.', $_POST['price']);
$quotedDescription = $_POST['desc'];
$key = KeyGenerator::genKey();
$query = 'insert into books' . ' (author, title, year, price, isbn, description, mail, auth_key' . ', created,expires)' . ' values (' . '"' . $quotedAuthor . '"' . ', "' . $quotedTitle . '"' . ', "' . $year . '"' . ', "' . $price . '"' . ', "' . $isbn . '"' . ', "' . $quotedDescription . '"' . ', "' . $this->getMail() . '"' . ', "' . $key . '"' . ', now()' . ', date_add(now(), interval 45 day)' . ')';
mysql_query($query);
$book_id = mysql_insert_id();
$this->selectableCategories->setBookId($book_id);
$this->selectableCategories->update();
$subject = '';
$message = 'Mit deiner E-Mailadresse wurde das unten stehende Buch angeboten. Hebe diese E-Mail auf, um das Angebot später ändern und löschen zu können.';
Mailer::send($book_id, $subject, $message);
$searches = new Searches();
if ($searches->areActivated()) {
$author = stripslashes($quotedAuthor);
$title = stripslashes($quotedTitle);
$description = stripslashes($quotedDescription);
$searches->bookAdded($book_id, $author, $title, $description);
}
header('Location: book.php?id=' . $book_id . '&key=' . $key . '&new=1');
exit;
}
示例11: handle
/**
* Execute the job.
*
* @return void
*/
public function handle(Mailer $mailer)
{
//
$mailer->send('emails.welcome', ['user' => $this->user], function ($m) {
//
});
}
示例12: _login
function _login()
{
// On masque le header et le footer
$this->autoFireHead = false;
$this->autoFireHeader = false;
$this->autoFireDebug = false;
$this->autoFireFooter = false;
// Formulaire d'envoi d'un nouveau password
if (isset($_POST['form_new_password'])) {
if ($this->users->get(trim($_POST['email']), 'email')) {
// Generation du nouveau mot de passe
$this->new_password = $this->ficelle->generatePassword(7);
$this->users->password = md5($this->new_password);
$this->users->update();
//***********************************************//
//*** ENVOI DU MAIL AVEC NEW PASSWORD NON EMT ***//
//***********************************************//
// Recuperation du modele de mail
$this->mails_text->get('admin-nouveau-mot-de-passe', 'lang = "' . $this->language . '" AND type');
// Variables du mailing
$cms = $this->cms;
$surl = $this->surl;
$url = $this->lurl;
$email = trim($_POST['email']);
$password = $this->new_password;
// Attribution des données aux variables
$sujetMail = $this->mails_text->subject;
eval("\$sujetMail = \"{$sujetMail}\";");
$texteMail = $this->mails_text->content;
eval("\$texteMail = \"{$texteMail}\";");
$exp_name = $this->mails_text->exp_name;
eval("\$exp_name = \"{$exp_name}\";");
// Nettoyage de printemps
$sujetMail = strtr($sujetMail, 'ÀÁÂÃÄÅÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝÇçàáâãäåèéêëìíîïòóôõöùúûüýÿÑñ', 'AAAAAAEEEEIIIIOOOOOUUUUYCcaaaaaaeeeeiiiiooooouuuuyynn');
$exp_name = strtr($exp_name, 'ÀÁÂÃÄÅÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝÇçàáâãäåèéêëìíîïòóôõöùúûüýÿÑñ', 'AAAAAAEEEEIIIIOOOOOUUUUYCcaaaaaaeeeeiiiiooooouuuuyynn');
// Envoi du mail
$this->email = $this->loadLib('email', array());
$this->email->setFrom($this->mails_text->exp_email, $exp_name);
$this->email->addRecipient(trim($_POST['email']));
$this->email->addBCCRecipient('j.dehais@equinoa.fr');
$this->email->setSubject('=?UTF-8?B?' . base64_encode($sujetMail) . '?=');
$this->email->setHTMLBody($texteMail);
Mailer::send($this->email, $this->mails_filer, $this->mails_text->id_textemail);
// Mise en session du message
$_SESSION['msgErreur'] = 'newPassword';
$_SESSION['newPassword'] = 'OK';
// Renvoi sur la page de login
header('Location:' . $this->lurl . '/login');
die;
} else {
// Mise en session du message
$_SESSION['msgErreur'] = 'newPassword';
$_SESSION['newPassword'] = 'NOK';
header('Location:' . $this->lurl . '/login');
die;
}
}
}
示例13: send
public function send($parsed_object, $parcel, $debug = FALSE)
{
$parsed_object->settings = $parcel->settings;
$mailer = new Mailer($parsed_object);
$response = $mailer->send();
if (!$response) {
$this->show_error('An unknown error has occurred when sending email with your server.');
}
return new Postmaster_Service_Response(array('status' => $response ? POSTMASTER_SUCCESS : POSTMASTER_FAILED, 'parcel_id' => $parcel->id, 'channel_id' => isset($parcel->channel_id) ? $parcel->channel_id : FALSE, 'author_id' => isset($parcel->entry->author_id) ? $parcel->entry->author_id : FALSE, 'entry_id' => isset($parcel->entry->entry_id) ? $parcel->entry->entry_id : FALSE, 'gmt_date' => $this->now, 'service' => $parcel->service, 'to_name' => $parsed_object->to_name, 'to_email' => $parsed_object->to_email, 'from_name' => $parsed_object->from_name, 'from_email' => $parsed_object->from_email, 'cc' => $parsed_object->cc, 'bcc' => $parsed_object->bcc, 'subject' => $parsed_object->subject, 'message' => !empty($parsed_object->message) ? $parsed_object->message : $parsed_object->html_message, 'html_message' => $parsed_object->html_message, 'plain_message' => $parsed_object->plain_message, 'parcel' => $parcel));
}
示例14: send_account_enabled
/**
* send_account_enabled
* This sends the account enabled email for the specified user
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public static function send_account_enabled($username, $fullname, $email)
{
$mailer = new Mailer();
$mailer->set_default_sender();
$mailer->subject = sprintf(T_("Account enabled at %s"), AmpConfig::get('site_title'));
$mailer->message = sprintf(T_("Your account %s has been enabled\n\n\n Please logon using %s"), $username, AmpConfig::get('web_path') . "/login.php");
$mailer->recipient = $email;
$mailer->recipient_name = $fullname;
$mailer->send();
}
示例15: hook_shipment_post
function hook_shipment_post(&$user, &$shipment, &$session)
{
$mailer = new Mailer($user['folder']);
$mailer->addRcpt($shipment->ship_contact, 'pickup@minimaxexpress.com');
$mailer->dataObj = $shipment->toArray();
$mailer->dataObj['del_note'] = $session->account_notes . " " . $mailer->dataObj['del_note'];
$mailer->template = "order_summary";
$mailer->subject = "WEB ORDER #" . $shipment->ext_id;
$mailer->send();
}