/** * Index method * * @return void */ public function invite($tournament_id, $product_id, $count_teams) { if ($this->request->is('post')) { foreach ($this->request->data['player'] as $i => $invites) { $email = new Email('korujafc'); if ($this->request->data['player_status'][$i] == 'email') { $about = '[KorujaFC] Você foi convidado para o KorujaFC!'; $message = '<img src="http://www.korujafc.com/img/logo.png" alt="logo"> <h3>Olá,</h3> <p>Clique aqui e faça sua inscrição no site para participar do torneio:<a href="http://www.korujafc.com/products/payment/' . $product_id . '/' . $tournament_id . '">INSCREVER</a></p> <spam><i>2016 / <a href="http://www.korujafc.com">KORUJAFC.COM</a></i></spam>'; $email->emailFormat('html')->to($invites)->subject($about)->send($message); } elseif ($this->request->data['player_status'][$i] == 'login') { $about = '[KorujaFC] Você foi convidado para um torneio.'; $message = '<img src="http://www.korujafc.com/img/logo.png" alt="logo"> <h3>Olá, ' . $this->request->data['player'][$i] . '</h3> <p>Clique aqui para participar do torneio:<a href="http://www.korujafc.com/products/payment/' . $tournament_id . '">INSCREVER</a></p> <spam><i>2016 / <a href="http://www.korujafc.com">KORUJAFC.COM</a></i></spam>'; $email->emailFormat('html')->to($this->request->data['userEmail'][$i])->subject($about)->send($message); } elseif ($this->request->data['player_status'][$i] == 'free') { $transactionsTable = TableRegistry::get('Transactions'); $transaction = $transactionsTable->newEntity(); $transaction->tournament_id = $tournament_id; $transaction->product_id = $product_id; $transaction->user_id = $this->request->data['userId'][$i]; $transactionsTable->save($transaction); } } $this->Flash->success('Invitations has been sended.'); return $this->redirect(['controller' => 'Tournaments', 'action' => 'index', 1]); } $this->set('count_teams', $count_teams); }
public function emailToManager() { //$this->out('Hello Manager'); $email = new Email('default'); $email->from(['*****@*****.**' => 'Administrator dimanamacet.com'])->to('*****@*****.**')->subject('Daily Activity')->send('Lorem Ipsum DOlor sit Amet'); $this->out('Success'); }
public function sendMail() { $mailer = new Email(); $mailer->transport('smtp'); $email_to = '*****@*****.**'; $replyToEmail = "*****@*****.**"; $replyToEmailName = 'Info'; $fromEmail = "*****@*****.**"; $fromEmailName = "Xuan"; $emailSubject = "Demo mail"; //$view_link = Router::url('/', true); $params_name = 'XuanNguyen'; $view_link = Router::url(['language' => $this->language, 'controller' => 'frontend', 'action' => 'view_email', 'confirmation', $params_name], true); $sentMailSatus = array(); if (!empty($email_to)) { //emailFormat text, html or both. $mailer->template('content', 'template')->emailFormat('html')->subject($emailSubject)->viewVars(['data' => ['language' => $this->language, 'mail_template' => 'confirmation', 'email_vars' => ['view_link' => $view_link, 'name' => $params_name]]])->from([$fromEmail => $fromEmailName])->replyTo([$replyToEmail => $replyToEmailName])->to($email_to); if ($mailer->send()) { $sentMailSatus = 1; } else { $sentMailSatus = 0; } } pr($sentMailSatus); exit; }
/** * send mail * @param type $id * @param type $email * @param type $url * @param type $subject * @param type $body */ public function send($id, $email, $url, $subject, $body) { $mail = new Email('default'); $key = Configure::read('key.encrypt'); $token = sha1($id . $key); $link = Router::url('/', true) . $url . '/' . $token; $mail->to($email)->subject($subject)->emailFormat("html")->send("<a href='" . $link . "'>" . $body . "<a>"); }
protected function _execute(array $data) { // aqui vai a lógica $email = new Email('gmail'); $email->to('*****@*****.**'); $email->subject('contato do sistema'); $msg = "\n\t\t\t<b>De:</b> {$data['nome']}<br />\n\t\t\t<b>Email:</b> {$data['email']}<br />\n\t\t\t<b>msg:</b> {$data['msg']}<br />\n\t\t"; return $email->send($msg); }
public function _execute(array $data) { $mensagem = sprintf('Contato feito pelo site <br> Nome: %s<br> Email: %s<br> Mensagem: %s', $data['nome'], $data['email'], $data['mensagem']); $email = new Email('gmail'); $email->to('*****@*****.**'); $email->subject('Contato'); $email->emailFormat('html'); return $email->send($mensagem); }
public function dadosAtualizados() { $users = $ldap->getUsers("uid=*"); $emails = array(); foreach ($users as $user) { $email = $user['uid'][0] . '@smt.ufrj.br'; array_push($emails, $email); } $email = new Email('gmail'); $email->from(['*****@*****.**' => 'Controle de Usuarios'])->emailFormat('html')->to($emails)->subject('Notificação SMT')->send('Favor manter seus dados atualizados.'); $aviso = new Email('gmail'); $aviso->from(['*****@*****.**' => 'Controle de Usuarios'])->emailFormat('html')->to('*****@*****.**')->subject('JOB Realizado')->send('Job Dados Atualizados executado com sucesso.'); }
function userSignupEmail($event) { $this->emails = TableRegistry::get('Emails'); $emailTemplate = $this->emails->find()->where(['Emails.code' => 'signup_email'])->first(); $user = $event->data['user']; $emailAddress = $user->email; $params = ['%name%' => $user->name, '%email%' => $user->email]; $subject = str_replace(array_keys($params), array_values($params), $emailTemplate->subject); $content = str_replace(array_keys($params), array_values($params), $emailTemplate->message); echo $emailAddress; $email = new Email('default'); $email->emailFormat('both')->to($emailAddress)->subject($subject)->viewVars(['content' => $content])->send(); }
/** * Check email in stack and send to user * @throws Exception * @return void */ public function sendMail() { $mails = $this->EmailStacks->find()->where(['sent' => false]); $dataResult = []; foreach ($mails as $row) { $email = new Email('default'); if ($email->to($row->email)->subject($row->subject)->send($row->content)) { $ent = $this->EmailStacks->get($row->id); $ent->sent = true; $this->EmailStacks->save($ent); } } }
protected function _execute(array $data) { //print_r($data); exit; if (null != $data['email']) { $adminEmail = "*****@*****.**"; //EMAIL THE Admin $subject = __('A new form submission been received from the MarketingConneX.com Challenges landing page'); $email = new Email('default'); $email->sender($data['email'], $data['firstname']); $email->from([$data['email'] => $data['firstname']])->to([$adminEmail => 'marketingconneX.com'])->subject($subject)->emailFormat('html')->template('landingpageform')->viewVars(array('firstname' => $data['firstname'], 'lastname' => $data['lastname'], 'email' => $data['email'], 'website' => $data['website'], 'phone' => $data['phone'], 'info' => $data['info'], 'landingpage' => $data['landingpage']))->send(); return true; } return false; }
/** * Check email in stack and send to user * @throws Exception * @return void */ public function sendMail() { $mails = $this->EmailStacks->find()->where(['sent' => false]); $dataResult = []; foreach ($mails as $row) { $email = new Email('default'); if ($email->emailFormat('html')->template('content')->to($row->email)->subject($row->subject)->viewVars(['content' => $row->content])->send()) { $ent = $this->EmailStacks->get($row->id); $ent->sent = true; $this->EmailStacks->save($ent); } } return true; }
public function reminder() { if ($this->request->is('post')) { $user = $this->Users->findByEmail($this->request->data['email'])->first(); if ($user) { $email = new Email('default'); $email->template('reminder', 'default')->to($user->email)->subject('Recuperação de Senha')->viewVars(['name' => $user->name, 'email' => $user->email, 'password' => (new LegacyPasswordHasher())->decode($user->password)])->send(); unset($this->request->data['email']); $this->Flash->success(__('We sent an email to you. Open your inbox to check your password.'), ['key' => 'auth']); } else { $this->Flash->error(__('E-mail does not exist.'), ['key' => 'auth']); } } }
/** * Alari Contact */ public function contact() { if ($this->request->is('post')) { //Send email to admin after saving the inquiry $data = []; $data['from'] = $this->request->data['FullName']; $data['email'] = $this->request->data['Email']; $data['message'] = $this->request->data['Message']; $email = new Email('default'); $email->template('inquiry')->emailFormat('text')->subject('Inquiry')->to(OWNER_EMAIL)->viewVars($data)->send(); $this->Flash->success('Your inquiry has been sent successfully.'); return $this->redirect(['action' => 'contact']); } }
public function resetPass($email) { if (!isset($email)) { return false; } $users = TableRegistry::get('Users'); $user = $users->find()->where(['Users.email' => $email])->first(); if (!isset($user)) { return false; } $msg = new Email(); $msg->transport('default')->from(['*****@*****.**' => 'Game Master'])->to($user->email)->subject('VGPhotohunt - Reset Your Password')->template('resetPass')->viewVars(['token' => $user->confirmation_token, 'username' => $user->username])->send(); return true; }
/** * * @author Anand Thakkar <*****@*****.**> * @param Email $email * @throws \App\Network\Email\Mandrill_ErrorS */ public function send(Email $email) { $headers = $email->getHeaders(['from', 'sender', 'replyTo', 'to', 'cc', 'bcc']); try { $message = array('html' => '<p>This is the body of the Email</p>', 'text' => 'This is the body of the Email', 'subject' => 'Testing mandrill Application', 'from_email' => $headers['From'], 'from_name' => $headers['Sender'], 'to' => array(array('email' => $headers['To'], 'type' => 'to')), 'headers' => array('Reply-To' => $headers['Reply-To']), 'important' => false); $async = false; $ip_pool = 'Main Pool'; $send_at = FALSE; $result = $this->mandrill->messages->send($message, $async, $ip_pool, $send_at); } catch (Mandrill_Error $e) { echo 'A mandrill error occurred: ' . get_class($e) . ' - ' . $e->getMessage(); //throw $e; } }
protected function _execute(array $data) { //print_r($data); exit; if (null != $data['email']) { //SEND TO SALES FORCE //----------------------------------- //then bundle the request and send it to Salesforce.com $req = "&lead_source=" . "Web"; $req .= "&first_name=" . $data['firstname']; $req .= "&last_name=" . $data['lastname']; $req .= "&company=" . $data['company']; $req .= "&00N20000009ZAQB=" . $data['position']; $req .= "&email=" . $data['email']; $req .= "&phone=" . $data['phone']; $req .= "&debug=" . urlencode("0"); $req .= "&oid=" . urlencode("00D20000000ozqG"); $req .= "&retURL=" . urlencode("http://qa.marketingconnex.com/pages/thank-you"); $req .= "&debugEmail=" . urlencode("*****@*****.**"); $header = "POST /servlet/servlet.WebToLead?encoding=UTF-8 HTTP/1.0\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Host: www.salesforce.com\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; $fp = fsockopen('www.salesforce.com', 80, $errno, $errstr, 30); if (!$fp) { echo "No connection made"; } else { fputs($fp, $header . $req); while (!feof($fp)) { $res = fgets($fp, 1024); //echo $res; } } fclose($fp); //----------------------------------- $adminEmail = "*****@*****.**"; //EMAIL THE CUSTOMER $subject = __('Thank you for contacting MarketingConneX.com'); $email = new Email('default'); $email->sender($adminEmail, 'marketingconneX.com'); $email->from([$adminEmail => 'marketingconneX.com'])->to([$data['email'] => $data['name']])->subject($subject)->emailFormat('html')->template('contactform', 'system')->viewVars(array('email_type' => 'customer', 'name' => $data['firstname'], 'company' => $data['company'], 'position' => $data['position'], 'email' => $data['email'], 'site_url' => 'http://www.marketingconnex.com', 'SITE_NAME' => 'MarketingConneX.com', 'phone' => $data['phone'], 'info' => $data['info'], 'message' => $data['message']))->send(); //EMAIL THE Admin $subject = __('A new enquiry has been received on MarketingConneX.com'); $email = new Email('default'); $email->sender($adminEmail, 'marketingconneX.com'); $email->from([$data['email'] => $data['name']])->to([$adminEmail => 'marketingconneX.com'])->subject($subject)->emailFormat('html')->template('contactform', 'system')->viewVars(array('email_type' => 'admin', 'name' => $data['firstname'], 'company' => $data['company'], 'position' => $data['position'], 'email' => $data['email'], 'site_url' => 'http://www.marketingconnex.com', 'SITE_NAME' => 'MarketingConneX.com', 'phone' => $data['phone'], 'info' => $data['info'], 'message' => $data['message']))->send(); return true; } return false; }
public function requestPasswordReset() { $user = $this->Users->newEntity(); if ($this->request->is('post')) { $user = $this->Users->patchEntity($user, $this->request->data, ['validate' => 'requestPasswordReset']); if (!$user->errors()) { $token = $this->Users->savePasswordToken($this->request->data['email']); $email = new Email('default'); $email->viewVars(['token' => $token, 'name' => $user->name])->from(['*****@*****.**' => 'LifeSpark'])->to($user->email)->emailFormat('html')->template('password_reset')->subject('Wachtwoord veranderen op LifeSpark.nl'); $this->Flash->success(__('An email has been send to {0}', [$this->request->data['email']])); return $this->redirect(['action' => 'login']); } } $this->set('user', $user); }
/** * Send mail * * @param Email $email Email * @return array */ public function send(Email $email) { if (!empty($this->_config['queue'])) { $this->_config = $this->_config['queue'] + $this->_config; $email->config((array) $this->_config['queue'] + ['queue' => []]); unset($this->_config['queue']); } $transport = $this->_config['transport']; $email->transport($transport); $QueuedTasks = TableRegistry::get('Queue.QueuedTasks'); $result = $QueuedTasks->createJob('Email', ['transport' => $transport, 'settings' => $email]); $result['headers'] = ''; $result['message'] = ''; return $result; }
public function afterForgot($event, $user) { $email = new Email('default'); $email->viewVars(['user' => $user, 'resetUrl' => Router::fullBaseUrl() . Router::url(['prefix' => false, 'plugin' => 'Users', 'controller' => 'Users', 'action' => 'reset', $user['email'], $user['request_key']]), 'baseUrl' => Router::fullBaseUrl(), 'loginUrl' => Router::fullBaseUrl() . '/login']); $email->from(Configure::read('Users.email.from')); $email->subject(Configure::read('Users.email.afterForgot.subject')); $email->emailFormat('both'); $email->transport(Configure::read('Users.email.transport')); $email->template('Users.afterForgot', 'Users.default'); $email->to($user['email']); $email->send(); }
/** * * @author Anand Thakkar <*****@*****.**> * @param Email $email * @throws \App\Network\Email\Mandrill_ErrorS */ public function send(Email $email) { $headers = $email->getHeaders(['from', 'sender', 'replyTo', 'to', 'cc', 'bcc']); try { pr($email); die('we are here'); $message = array('html' => '<p>Example HTML content</p>', 'text' => 'Example text content', 'subject' => 'example subject', 'from_email' => $headers['From'], 'from_name' => $headers['Sender'], 'to' => array(array('email' => $headers['To'], 'type' => 'to')), 'headers' => array('Reply-To' => $headers['Reply-To']), 'important' => false); $async = false; $ip_pool = 'Main Pool'; $send_at = FALSE; $result = $this->mandrill->messages->send($message, $async, $ip_pool, $send_at); } catch (Mandrill_Error $e) { echo 'A mandrill error occurred: ' . get_class($e) . ' - ' . $e->getMessage(); throw $e; } }
public function sendMail($to, $subject, $from, $message, $attachments = null, $emailCofig = 'default', $emailtemplate = 'default', $formate = 'html', $replyto = null, $cc = null, $bcc = null) { $email = new Email('default'); $email->emailFormat($formate); $email->from(array($from => Configure::read('FROM_EMAIL_NAME'))); $email->to($to); $email->cc($cc); $email->bcc($bcc); $email->replyTo($replyto); $email->subject($subject); $email->template($emailtemplate, 'default'); // $email->attachments($attachments); if ($email->send($message)) { return true; } else { return false; } }
public function email() { if ($this->request->is('get')) { $userId = $this->Auth->user('id'); $username = $this->Auth->user('username'); $this->loadModel('UserTypes'); $userTypes = $this->UserTypes->listSubCategories(); $this->set(compact('userId', 'username', 'userTypes')); } else { if ($this->request->is('post')) { Email::configTransport('gmail', ['host' => 'smtp.gmail.com', 'port' => 587, 'username' => '*****@*****.**', 'password' => 'mustang996', 'className' => 'Smtp', 'tls' => true]); $email = new Email(); $email->transport('gmail'); $email->from(['*****@*****.**' => 'Store Site'])->to('*****@*****.**')->emailFormat('html')->subject(FormatContactForm::getSubject($this->request->data['subject'], ['suffix' => ' | Store Site']))->send(FormatContactForm::getMessage($this->request->data, ['uppercaseLabel' => true])); return $this->redirect(['controller' => 'CustomStaticPages', 'action' => 'index']); } } }
/** * Contact page. * * @return \Cake\Network\Response|void */ public function index() { $contact = ['schema' => ['name' => ['type' => 'string', 'length' => 100], 'email' => ['type' => 'string', 'length' => 100], 'subject' => ['type' => 'string', 'length' => 255], 'message' => ['type' => 'string']], 'required' => ['name' => 1, 'email' => 1, 'message' => 1]]; if ($this->request->is('post')) { $validator = new Validator(); $validator->notEmpty('email', __('You need to put your E-mail.'))->add('email', 'validFormat', ['rule' => 'email', 'message' => __("You must specify a valid E-mail address.")])->notEmpty('name', __('You need to put your name.'))->notEmpty('message', __("You need to give a message."))->add('message', 'minLength', ['rule' => ['minLength', 10], 'message' => __("Your message can not contain less than {0} characters.", 10)]); $contact['errors'] = $validator->errors($this->request->data()); if (empty($contact['errors'])) { $viewVars = ['ip' => $this->request->clientIp()]; $viewVars = array_merge($this->request->data(), $viewVars); $email = new Email(); $email->profile('default')->template('contact')->emailFormat('html')->from(['*****@*****.**' => 'Contact Form'])->to(Configure::read('Author.email'))->subject($viewVars['subject'] ? $viewVars['subject'] : 'Someone has contacted you')->viewVars($viewVars)->send(); $this->Flash->success(__("Your message has been sent successfully, you will get a response shortly !")); return $this->redirect('/'); } } $this->set(compact('contact')); }
public function contact() { $this->set('title_for_layout', 'Contact'); if ($this->request->is('post')) { if ($this->request->data['captcha'] != $_SESSION['captcha']) { $this->Flash->error(__('Please enter correct captcha code and try again.', true)); } else { //SEND EMAIL $email = new Email(); $email->transport('default'); $email->from([$this->request->data['email'] => $this->request->data['name']])->to(Configure::read('cakeblog_contact_email'))->subject('Website Contact - ' . $this->request->data['type'])->send($this->request->data['message']); $this->Flash->success(__('Your message has been submitted')); return $this->redirect("" . Configure::read('BASE_URL') . "/contact"); } } //RENDER THEME VIEW $this->render('' . Configure::read('cakeblog_theme') . '.contact'); }
protected function _execute(array $data) { $email = new Email('default'); $email->template("devis"); $email->emailFormat("both"); $email->viewVars($data); $email->from(["*****@*****.**" => "Contact Reno Patrimoine"]); $email->to("*****@*****.**"); $email->subject("Demande de devis: " . $data["prenom"] . " " . $data["nom"]); $email->send(); return true; }
public function main() { $this->loadModel('Comms'); $comms = $this->Comms->find('all')->select(['Comms.id', 'Comms.dest', 'Comms.subject', 'Comms.body', 'Users.email'])->contain('Users')->where(['OR' => [['comms_status_id' => COMM_NEW], ['comms_status_id' => 0]]])->limit(10)->toArray(); foreach ($comms as $comm) { //TODO: correct this unreliable and inflexible way to send emails Email::deliver(COMPANY_EMAIL, $comm->subject, $comm->body, ['from' => $comm->user->email, 'transport' => 'default', 'domain' => WEBSITE_DOMAIN]); $this->Comms->patchEntity($comm, ['comms_status_id' => COMM_COMPLETED]); $this->Comms->save($comm); } }
/** * Abstract sender method * * @param User $user The recipient user * @param Notification $notification the notification to be sent * @param NotificationContent $content the content * @return mixed */ public function sendNotification(User $user, Notification $notification, NotificationContent $content) { $subject = $content->render('email_subject', $notification); $htmlBody = $content->render('email_html', $notification); $textBody = $content->render('email_text', $notification); $email = new Email($this->_config['profile']); $email->transport($this->_config['emailTransport']); $email->emailFormat('html'); if (!empty($notification->config['attachments'])) { $email->attachments($notification->config['attachments']); } $email->to([$user->email => $user->firstname . ' ' . $user->lastname]); $email->subject($subject); if (!empty($this->_config['templated']) && !empty($this->_config['template']) && !empty($this->_config['layout'])) { $email->template($this->_config['template'], $this->_config['layout']); $email->viewVars(['content' => $htmlBody]); return $email->send(); } return $email->send($htmlBody); }
/** * Send mail * * @param \Cake\Network\Email\Email $email Cake Email * @return array */ public function send(Email $email) { $eol = PHP_EOL; if (isset($this->_config['eol'])) { $eol = $this->_config['eol']; } $headers = $email->getHeaders(array('from', 'sender', 'replyTo', 'readReceipt', 'returnPath', 'to', 'cc', 'bcc')); $to = $headers['To']; unset($headers['To']); foreach ($headers as $key => $header) { $headers[$key] = str_replace(array("\r", "\n"), '', $header); } $headers = $this->_headersToString($headers, $eol); $subject = str_replace(array("\r", "\n"), '', $email->subject()); $to = str_replace(array("\r", "\n"), '', $to); $message = implode($eol, $email->message()); $params = isset($this->_config['additionalParameters']) ? $this->_config['additionalParameters'] : null; $this->_mail($to, $subject, $message, $headers, $params); return array('headers' => $headers, 'message' => $message); }
/** * TestSend method * * @return void */ public function testSendWithEmail() { $Email = new Email(); $Email->from('*****@*****.**', 'CakePHP Test'); $Email->to('*****@*****.**', 'CakePHP'); $Email->cc(['*****@*****.**' => 'Mark Story', '*****@*****.**' => 'Juan Basso']); $Email->bcc('*****@*****.**'); $Email->subject('Testing Message'); $Email->transport('queue'); $config = $Email->config('default'); $this->QueueTransport->config($config); $result = $this->QueueTransport->send($Email); $this->assertEquals('Email', $result['jobtype']); $this->assertTrue(strlen($result['data']) < 10000); $output = unserialize($result['data']); //debug($output); //$this->assertEquals($Email, $output['settings']); }
/** * Prepares the message body. * * @return string */ protected function _prepareMessage() { $lines = $this->_cakeEmail->message(); $messages = array(); foreach ($lines as $line) { if (!empty($line) && $line[0] === '.') { $messages[] = '.' . $line; } else { $messages[] = $line; } } return implode("\r\n", $messages); }