本文整理汇总了PHP中Mail::failures方法的典型用法代码示例。如果您正苦于以下问题:PHP Mail::failures方法的具体用法?PHP Mail::failures怎么用?PHP Mail::failures使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mail
的用法示例。
在下文中一共展示了Mail::failures方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postRegister
/**
* @return string
* User Registration.
*/
public function postRegister()
{
$input = Input::only('firstname', 'lastname', 'email', 'password', 'confirm_password');
try {
$rules = array('firstname' => 'required|min:2', 'lastname' => 'required|min:2', 'email' => 'required|email|unique:users', 'password' => 'required|min:4', 'confirm_password' => 'required|same:password');
$messages = array('required' => 'Het :attribute veld is verplicht in te vullen.', 'min' => 'Het :attribute veld moet minstens 2 karakters bevatten.');
$validator = Validator::make($input, $rules, $messages);
if ($validator->fails()) {
return Redirect::back()->withInput()->withErrors($validator);
} else {
unset($input['confirm_password']);
$user = Sentry::register($input);
$activationCode = $user->getActivationCode();
$data = array('token' => $activationCode);
Mail::send('emails.auth.welcome', $data, function ($message) use($user) {
$message->from('info@wardkennes.be', 'Site Admin');
$message->to($user['email'], $user['first_name'], $user['last_name'])->subject('Welcome to My Laravel app!');
});
if (count(Mail::failures()) > 0) {
$errors = 'Failed to send password reset email, please try again.';
}
if ($user) {
return Redirect::action('AuthController@login');
}
}
} catch (Sentry\SentryException $e) {
// Create custom error msgs.
}
}
示例2: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$data = Input::only(['name', 'rank', 'email', 'myMessage', 'g-recaptcha-response']);
$google_url = "https://www.google.com/recaptcha/api/siteverify";
$secret = Config::get('recaptcha.secret_key');
$url = $google_url . "?secret=" . $secret . "&response=" . $data['g-recaptcha-response'];
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16");
$curlData = curl_exec($curl);
curl_close($curl);
$response = json_decode($curlData, true);
if ($response['success'] == true) {
$rules = array('name' => 'required|min:3|max:100', 'rank' => 'required|min:3|max:50', 'email' => 'required|email|unique:users|unique:invitations', 'myMessage' => 'required|min:5|max:300');
$validator = Validator::make($data, $rules);
if ($validator->fails()) {
return Redirect::route('admin.request.index')->withErrors($validator->messages());
} else {
Mail::send('emails.auth.request', $data, function ($message) {
$message->to('mertindervish@gmail.com', 'РегистърБГ')->subject('Нова заявка за покана в РегистърБГ');
$message->to('admin@registerbg.com', 'РегистърБГ')->subject('Нова заявка за покана в РегистърБГ');
});
if (count(Mail::failures()) > 0) {
return Redirect::route('admin.request.index')->withErrors(array('mainError' => 'Възникна грешка при изпращане на имейл. Моля опитайте по-късно.'));
}
return Redirect::route('admin.request.index')->withErrors(array('mainSuccess' => 'Заявката е успшно изпратена. Възможно най-бързо ще получите обратна връзка.'));
}
}
return Redirect::route('admin.request.index')->withErrors(array('g-recaptcha-response' => 'Моля потвърдете, че не сте робот.'));
/*return Redirect::route('admin.index');*/
}
示例3: consultaContacto
public function consultaContacto()
{
$data = Input::all();
$this->array_view['data'] = $data;
Mail::send('emails.consulta-contacto', $this->array_view, function ($message) use($data) {
$message->from($data['email'], $data['nombre'])->to('max.-ang@hotmail.com.ar')->subject('Consulta');
});
if (count(Mail::failures()) > 0) {
$mensaje = 'El mail no pudo enviarse.';
} else {
$mensaje = 'El mail se envió correctamente';
}
if (isset($data['continue']) && $data['continue'] != "") {
switch ($data['continue']) {
case "contacto":
return Redirect::to('contacto')->with('mensaje', $mensaje);
break;
case "menu":
$menu = Menu::find($data['menu_id']);
return Redirect::to('/' . $menu->url)->with('mensaje', $mensaje);
break;
}
}
return Redirect::to("/")->with('mensaje', $mensaje);
//return View::make('producto.editar', $this->array_view);
}
示例4: actionSend
public function actionSend()
{
if (Input::get('to') && Input::get('subject') && Input::get('message')) {
$to = Input::get('to');
$subject = Input::get('subject');
$message = Input::get('message');
if (empty($to) || empty($subject) || empty($message)) {
$data = array('success' => false, 'message' => 'Please fill out the form completely.');
echo json_encode($data);
exit;
}
$email = new Email();
$email->to = $to;
if ($email->save()) {
Mail::send('emails.main', ['text' => $message, 'host' => $_SERVER['HTTP_HOST'], 'id' => $email->id], function ($message) use($to, $subject) {
$message->to($to)->subject($subject);
});
if (count(Mail::failures())) {
$data = array('success' => false, 'message' => 'Message could not be sent.');
$email->delete();
echo json_encode($data);
exit;
}
$data = array('success' => true, 'message' => 'Thanks! We have received your message.');
echo json_encode($data);
} else {
$data = array('success' => false, 'message' => 'Message could not be sent.');
echo json_encode($data);
}
} else {
$data = array('success' => false, 'message' => 'Please fill out the form completely.');
echo json_encode($data);
}
exit;
}
示例5: sendEmail
public function sendEmail($data)
{
Mail::send('emails.contact', $data, function ($message) use($data) {
$message->from($data['email_address'], $data['name']);
$message->to(Config::get('constants.mail'), 'Nedeljko Damnjanovic')->subject('Mali oglasi - kontakt');
});
return count(Mail::failures()) > 0;
}
示例6: sendVoucher
public function sendVoucher()
{
$time = Carbon\Carbon::now(new DateTimeZone('Europe/Istanbul'));
$data = array("name" => $this->text_value, "value" => $this->text_value, "currency" => $this->select_value_currency, "time" => $time);
Mail::send('emails.payment', $data, function ($message) {
$message->to('accounting@testtest.com')->subject('Payment successful');
});
if (count(Mail::failures()) > 0) {
return array("success" => "0", "error_message" => Lang::get("messages.mailFailed"));
} else {
return array("success" => "1");
}
}
示例7: send
public function send($template, $contact, $data, $subject)
{
$subject .= ' debug: ' . date('d.m H:i:s');
if (!$contact->hashcode) {
$contact->hashcode = md5($contact->email);
$contact->save();
}
$result = \Mail::send('emails.' . $template, ['contact' => $contact, 'data' => $data], function ($m) use($contact, $data, $subject) {
$m->from($this->fromEmail, $this->fromName);
$m->to($contact->email, $contact->name)->subject($subject);
});
$fail = \Mail::failures();
if (!empty($fail)) {
throw new \Exception('Could not send message to ' . $fail[0]);
}
//if(empty($result)) throw new \Exception('Email could not be sent.');
}
示例8: sendmail
private static function sendmail($memberid, $contactid, $templateid)
{
$data['member'] = User::findOrFail($memberid);
$contact = Contact::findOrFail($contactid);
$data['contact'] = $contact;
$data['idencrypted'] = $contact->encryptContact();
$data['emailtemplate'] = EmailTemplate::find($templateid);
$template = 'emails.templates.default';
Mail::send($template, $data, function ($message) use($data) {
$message->to($data['contact']->email, $data['contact']->full_name)->subject($data['emailtemplate']->subject);
});
if (count(Mail::failures()) > 0) {
return false;
} else {
return true;
}
}
示例9: resetpassword
public function resetpassword()
{
$input = Input::all();
$user = User::where('email', $input['email'])->first();
if (is_null($user)) {
throw new Prototype\Exceptions\EmailErrorException();
}
$user->update(['password' => Hash::make(DEFAULT_PASSWORD)]);
$mailData = [];
Mail::send('emails.changepass', $mailData, function ($message) use($user, $input) {
$message->to($input['email'], 'Hello' . $user->name)->subject('Authorize password');
});
if (Mail::failures()) {
throw new Prototype\Exceptions\EmailErrorException();
}
return Common::returnData(200, SUCCESS);
}
示例10: consultaContacto
public function consultaContacto()
{
$data = Input::all();
Input::flashOnly('nombre', 'email', 'telefono', 'consulta');
$reglas = array('email' => array('required', 'email'), 'nombre' => array('required'));
$validator = Validator::make($data, $reglas);
if ($validator->fails()) {
$messages = $validator->messages();
if ($messages->has('nombre')) {
$mensaje = $messages->first('nombre');
} elseif ($messages->has('email')) {
$mensaje = $messages->first('email');
} else {
$mensaje = Lang::get('controllers.cliente.datos_consulta_contacto_incorrectos');
}
return Redirect::to('/contacto')->with('mensaje', $mensaje)->with('error', true)->withInput();
} else {
$this->array_view['data'] = $data;
Mail::send('emails.consulta-contacto', $this->array_view, function ($message) use($data) {
$message->from($data['email'], $data['nombre'])->to('mariasanti38@hotmail.com')->subject('Consulta');
});
if (count(Mail::failures()) > 0) {
$mensaje = Lang::get('controllers.cliente.consulta_no_enviada');
} else {
$data['nombre_apellido'] = $data['nombre'];
Cliente::agregar($data);
$mensaje = Lang::get('controllers.cliente.consulta_enviada');
}
if (isset($data['continue']) && $data['continue'] != "") {
switch ($data['continue']) {
case "contacto":
return Redirect::to('contacto')->with('mensaje', $mensaje);
break;
case "menu":
$menu = Menu::find($data['menu_id']);
return Redirect::to('/' . $menu->url)->with('mensaje', $mensaje);
break;
}
}
return Redirect::to("/")->with('mensaje', $mensaje);
//return View::make('producto.editar', $this->array_view);
}
}
示例11: sendMail
public function sendMail()
{
$data['name'] = Input::get('name');
$data['email'] = Input::get('email');
$data['mailMessage'] = Input::get('message');
// return $data['email'];
// Mail::send('mail', $data, function( $message ) use ($data)
// {
// $message->to( Config::get('site.email'), Config::get('site.name') )
// ->subject('Ou gen yon nouvo imel KG.')
// ->replyTo( $data['email'] );
// });
Mail::queue('mail', $data, function ($message) use($data) {
$message->to(Config::get('site.email'), Config::get('site.name'))->subject('Ou gen yon nouvo imel KG.')->replyTo($data['email']);
});
if (count(Mail::failures()) > 0) {
return 0;
}
return 1;
}
示例12: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$data = Input::only('role_id', 'name', 'email');
$invitation = new Invitation();
$invitation->role_id = $data['role_id'];
$invitation->email = $data['email'];
$invitation->name = $data['name'];
try {
$invitation->save();
} catch (ValidationException $errors) {
return Redirect::route('admin.invitations.create')->withErrors($errors->getErrors());
}
$data['code'] = $invitation->code;
Mail::send('emails.auth.invitation', $data, function ($message) use($data) {
$message->to($data['email'], $data['name'])->subject('Покана за регистрация в РегистърБГ');
});
if (count(Mail::failures()) > 0) {
return Redirect::route('admin.invitations.index')->withErrors(array('mainError' => 'Възникна грешка при изпращане на имейл. Моля опитайте по-късно.'))->withInput();
}
return Redirect::route('admin.invitations.index')->withErrors(array('mainSuccess' => 'Поканата е успешно изпратена.'));
}
示例13: view
} else {
$userConfig[1] = 0;
}
return view('pages.home')->with('userConfig', $userConfig);
});
Route::post('/save', 'EditController@closeEditor');
Route::post('edit', 'EditController@openEditor');
Route::get('/dropbox', function () {
return view('pages.dropbox');
});
Route::get('sendemail', function () {
$emails = array("prannoy23@gmail.com", "rvyas303@gmail.com");
Mail::send('pages.email', [], function ($message) use($emails) {
$message->to($emails)->subject('This is test e-mail');
});
var_dump(Mail::failures());
exit;
});
Route::post('ShareView', 'ShareController@ShareViewMethod');
Route::get('faq', function () {
return view('pages.faq');
});
Route::get('computername', function () {
return view('pages.computername');
});
// Authentication routes...
Route::get('auth/login', 'Auth\\AuthController@getLogin');
Route::post('auth/login', 'Auth\\AuthController@postLogin');
Route::get('auth/logout', 'Auth\\AuthController@getLogout');
// Registration routes...
Route::get('register', 'Auth\\AuthController@getRegister');
示例14: resumenPedido
public function resumenPedido($info)
{
$data = $info;
$this->array_view['data'] = $data;
Mail::send('emails.consulta-pedido', $this->array_view, function ($message) use($data) {
$message->from($data['email'], $data['nombre'])->to('')->subject('Pedido de presupuesto');
});
if (count(Mail::failures()) > 0) {
$mensaje = 'El mail no pudo enviarse.';
$ok = FALSE;
} else {
//$data['nombre_apellido'] = $data['nombre'];
//Cliente::agregar($data);
$mensaje = 'El mail se envió correctamente';
$ok = TRUE;
}
return $ok;
}
示例15: postPassVerficationCode
public function postPassVerficationCode()
{
/** get value of hidden Text Field */
$input_verCode = Input::get('invisible_code');
/** set rules for validation */
$rules = array('password' => 'required|between:8,20', 'password_confirmation' => 'required|same:password');
/** instantiate Validator */
$passwordValidation = Validator::make(Input::all(), $rules);
if ($passwordValidation->fails()) {
return Redirect::to('passverification/' . $input_verCode)->withErrors($passwordValidation);
} else {
$showMessage = array('showConfirmMessage' => "Registration completed. You can now use your account to Login. Please check your email for more details. Thank you!", 'passwordCreated' => "1");
$input_password = Input::get('password');
$hash_password = RegistrationController::encryptPassword($input_password);
/** Generate Auth Code */
// $authCode = substr(md5(uniqid(mt_rand(), true)), 0, 6);
// $duplicateAuthCode = DB::table('tbl_users')->where('user_authcode', $authCode)->first();
/** regenerate code if exist */
// if (count($duplicateAuthCode) > 0) {
// $authCode = substr(md5(uniqid(mt_rand(), true)), 0, 6);
// }
/** initialize date and get new date value adter 24hour for expiration*/
// $date = date('Y-m-d H:i:s');
// $expireDate = date('Y-m-d H:i:s', strtotime($date . ' + 1 day'));
$user_key = mcrypt_create_iv($this->encrypt->getIvSize(), $this->encrypt->getRandomizer());
/** update table user password and insert auth code*/
$updateCredentials = DB::table('tbl_users')->where('user_email', Input::get('user_email'))->update(array('user_password' => $hash_password, 'user_emailverification' => "verified", 'user_status' => 1, 'user_type' => 2, 'user_key' => $user_key));
$getUserId = $this->GlobalModel->getModelRowDetailByColumnName('tbl_users', 'user_email', Input::get('user_email'), null);
$getUserId->id;
$getUserId->user_username;
if ($updateCredentials) {
$data = array('fname' => Input::get('fname'), 'lname' => Input::get('lname'), 'email' => Input::get('user_email'), 'password' => "{$input_password}");
try {
Mail::send('emails.user.secondEmailAuthenticationCode', $data, function ($message) {
$message->from('no-reply@ezibills.com', 'Ezibills');
$message->to(Input::get('user_email'), Input::get('fname') . ' ' . Input::get('lname'))->subject('Ezibills Account Registration');
});
} catch (Exception $ex) {
}
if (count(Mail::failures()) > 0) {
return "Error: Mail did not sent";
} else {
if (Input::get('verify') > 0) {
return Redirect::to('/admin');
} else {
$this->User->getUserDetailByEmail(Input::get('user_email'));
$theme = Theme::uses('homepage')->layout('default');
return $theme->of("home.regcomplete", array('success' => 'success'))->render();
}
}
}
}
}