Guest User

Untitled

a guest
Jan 31st, 2019
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. MAIL_DRIVER=smtp
  2. MAIL_HOST=smtp.gmail.com
  3. MAIL_PORT=587
  4. MAIL_USERNAME=meuemail@gmail.com
  5. MAIL_PASSWORD=minhasenha
  6. MAIL_ENCRYPTION=null
  7.  
  8. 'driver' => env('MAIL_DRIVER', 'smtp'),
  9. 'host' => env('MAIL_HOST', 'smtp.gmail.com'),
  10. 'port' => env('MAIL_PORT'),
  11. 'from' => ['address' => 'myemail@gmail.com', 'name' => 'Do not Reply'],
  12. 'encryption' => env('MAIL_ENCRYPTION'),
  13. 'username' => env('MAIL_USERNAME'),
  14. 'password' => env('MAIL_PASSWORD'),
  15. 'sendmail' => '/usr/sbin/sendmail -bs',
  16. 'to' => [
  17. 'address' => 'meuemail@gmail.com',
  18. 'name' => 'Novo Email'
  19. ],
  20.  
  21. class ContactForm extends ComponentBase
  22. {
  23.  
  24. public function componentDetails(){
  25. return [
  26. 'name' => 'Contact Form',
  27. 'description' => 'Simple contact form'
  28. ];
  29. }
  30.  
  31.  
  32. public function onSend(){
  33.  
  34. $vars = ['name' => Input::get('name'), 'email' => Input::get('email'), 'content' => Input::get('content'), 'phone' => Input::get('phone')];
  35. try {
  36. Mail::send('watchlearn.contact::mail.message', $vars, function($message) {
  37.  
  38. $message->to('meuemail@gmail.com', 'Admin Person');
  39. $message->subject('New message from contact form');
  40.  
  41. });
  42. } catch (Throwable $e) {
  43. var_dump($e->getMessage());
  44. }
  45.  
  46. }
  47.  
  48. }
Add Comment
Please, Sign In to add comment