本文整理汇总了PHP中Mailer::message方法的典型用法代码示例。如果您正苦于以下问题:PHP Mailer::message方法的具体用法?PHP Mailer::message怎么用?PHP Mailer::message使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mailer
的用法示例。
在下文中一共展示了Mailer::message方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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!'));
}
}
}
示例2: 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');
}
示例3: request
public function request()
{
$affiliates = new Affiliates($this->db);
if ($this->f3->exists('POST.request')) {
$audit = \Audit::instance();
$this->f3->scrub($_POST);
$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 (!preg_match("/^.{2,30}\$/", $this->f3->get('POST.tcgname'))) {
$this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid TCG Name.'));
}
if (!$audit->url($this->f3->get('POST.url'))) {
$this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid URL.'));
}
if (!$audit->url($this->f3->get('POST.button'))) {
$this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid button URL.'));
}
// process form if there are no errors
if (count($this->f3->get('SESSION.flash')) === 0) {
$this->f3->set('POST.status', 'Pending');
$mailer = new Mailer();
$message = $mailer->message()->setSubject($this->f3->get('tcgname') . ': Affiliation Request')->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/affiliation.htm'), 'text/html');
// send email & save to db
if ($mailer->send($message) && $affiliates->add()) {
$this->f3->push('SESSION.flash', array('type' => 'success', 'msg' => 'Your affiliation request has been sent successfully!'));
} 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!'));
}
}
}
$this->f3->reroute('/affiliates');
}
示例4: approveAffiliate
private function approveAffiliate($affiliates)
{
/***********************************
Process Approve Affiliate Form!
************************************/
$audit = \Audit::instance();
$this->f3->scrub($_POST);
$this->f3->set('SESSION.flash', array());
// process form if there are no errors
if (count($this->f3->get('SESSION.flash')) === 0) {
$this->f3->set('POST.status', 'Active');
// save to db
if ($affiliates->edit($this->f3->get('POST.id'))) {
$mailer = new Mailer();
$message = $mailer->message()->setSubject($this->f3->get('tcgname') . ': Affiliation Approved')->setFrom(array($this->f3->get('noreplyemail') => $this->f3->get('tcgname')))->setTo(array($affiliates->read(array('id=?', $this->f3->get('POST.id')), [])[0]->email))->setReplyTo(array($this->f3->get('tcgemail')))->setBody(Template::instance()->render('app/templates/emails/affiliate-approved.htm'), 'text/html');
// send email & save to db
if ($mailer->send($message)) {
$this->f3->push('SESSION.flash', array('type' => 'success', 'msg' => 'Approval email sent.'));
}
$this->f3->push('SESSION.flash', array('type' => 'success', 'msg' => 'Affiliate approved!'));
} else {
$this->f3->push('SESSION.flash', array('type' => 'danger', 'msg' => 'There was a problem processing the request. Please try again.'));
}
}
}
示例5: quit
private function quit()
{
/***********************************
Process Quit Form!
************************************/
$this->f3->scrub($_POST);
$members = new Members($this->db);
$this->f3->set('member', $members->read(array('id=?', $this->f3->get('SESSION.userID')), [])[0]);
$this->f3->set('SESSION.flash', array());
// nothing to validate!
// if there are no errors, process the form
if (count($this->f3->get('SESSION.flash')) === 0) {
$mailer = new Mailer();
$message = $mailer->message()->setSubject($this->f3->get('tcgname') . ': Quit Form (' . $this->f3->get('member')->name . ')')->setFrom(array($this->f3->get('noreplyemail') => 'MyTCG'))->setTo(array($this->f3->get('tcgemail')))->setReplyTo(array($this->f3->get('member')->email))->setBody(Template::instance()->render('app/templates/emails/quit-notif.htm'), 'text/html');
if ($mailer->send($message)) {
$this->f3->push('SESSION.flash', array('type' => 'success', 'msg' => 'Your quit form has been sent. Sorry to see you leave - we hope you\'ll change your mind and join us again in the future!'));
} 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!'));
}
}
}
示例6: index
public function index()
{
$cards = new Cards($this->db);
$members = new Members($this->db);
$this->f3->set('months', array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'));
if ($this->f3->exists('POST.join')) {
$audit = \Audit::instance();
$this->f3->scrub($_POST);
$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. Only letters, numbers, underscores (_), and dashes (-) are allowed.'));
}
if ($members->count(array('name=?', $this->f3->get('POST.name'))) != 0) {
$this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Your name is already taken by another player. Please select a different name and try again!'));
}
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' => 'Your email address is already in use by another player.'));
}
if (!$audit->url($this->f3->get('POST.url'))) {
$this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid trade post URL.'));
}
if (!preg_match("/^.{6,}\$/", $this->f3->get('POST.password'))) {
$this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Your password must contain at least 6 characters.'));
}
if ($this->f3->get('POST.password') !== $this->f3->get('POST.password2')) {
$this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Your passwords don\'t match!'));
}
if (!in_array($this->f3->get('POST.birthday'), $this->f3->get('months'))) {
$this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid birthday'));
}
if ($cards->count(array('id=?', $this->f3->get('POST.collecting'))) == 0) {
$this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid collecting deck.'));
}
if ($this->f3->get('POST.refer') !== '' && $members->count(array('name=?', $this->f3->get('POST.refer'))) == 0) {
$this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid referral - that player\'s name doesn\'t exist in our database. Please check your spelling and try again!'));
}
// 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!'));
}
// process form if there are no errors
if (count($this->f3->get('SESSION.flash')) === 0) {
$this->f3->set('POST.status', 'Pending');
$this->f3->set('POST.level', 1);
$this->f3->set('POST.membercard', 'No');
$this->f3->set('POST.mastered', 'None');
$this->f3->set('POST.wishlist', 'Coming soon.');
$this->f3->set('POST.biography', 'Coming soon.');
$this->f3->set('POST.password', password_hash($this->f3->get('POST.password'), PASSWORD_DEFAULT));
$this->f3->set('collectingID', $this->f3->get('POST.collecting'));
$this->f3->set('POST.collecting', $cards->getById($this->f3->get('POST.collecting'))->filename);
$mailer = new Mailer();
$message = $mailer->message()->setSubject($this->f3->get('tcgname') . ': New Member')->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/newmember.htm'), 'text/html');
// send email & save to db
if ($mailer->send($message) && $members->add()) {
$this->f3->set('sp', array());
// random choice cards
for ($i = 0; $i < $this->f3->get('num_startchoice'); $i++) {
$this->f3->push('sp', $cards->random(array('id=?', $this->f3->get('collectingID'))));
}
// random regular cards
for ($i = 0; $i < $this->f3->get('num_startreg'); $i++) {
$this->f3->push('sp', $cards->random(array('worth=?', 1)));
}
// random special cards
for ($i = 0; $i < $this->f3->get('num_startspc'); $i++) {
$this->f3->push('sp', $cards->random(array('worth=?', 2)));
}
$mailer = new Mailer();
$message = $mailer->message()->setSubject($this->f3->get('tcgname') . ': Starter Pack')->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/starterpack.htm'), 'text/html');
$result = $mailer->send($message);
// load welcome message
$this->f3->set('content', 'app/views/welcome.htm');
} 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!'));
}
}
}
if (!$this->f3->exists('content')) {
$this->f3->set('content', 'app/views/join.htm');
}
$this->f3->set('decks', $cards->allAlpha());
echo Template::instance()->render('app/templates/default.htm');
}