Created
March 12, 2018 12:06
-
-
Save oktavianto/83454e7848c62f5c71b5db1f11572258 to your computer and use it in GitHub Desktop.
Belajar SendGrid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Test Doang Mamang, {{ $isi }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return [ | |
'driver' => 'smtp', | |
'host' => 'smtp.sendgrid.net', | |
'port' => 587, | |
'encryption' => 'tls', | |
'username' => 'username_sendgrid', | |
'password' => 'password_sengrid', | |
'sendmail' => '/usr/sbin/sendmail -bs', | |
'markdown' => [ | |
'theme' => 'default', | |
'paths' => [ | |
resource_path('views/vendor/mail'), | |
], | |
], | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Route::get('/', function () { | |
return view('welcome'); | |
}); | |
Route::post('kirim', function() { | |
$data = array( | |
'isi' => Request::get('message'), | |
); | |
Mail::send('email', $data, function($message) { | |
$message->from('excel@oktavianto.id', 'Excel Dwi Oktvianto'); | |
$message->to(Request::get('email'))->subject('Belajar SendGrid Euy!'); | |
}); | |
dd('Berhasil Dikirim.'); | |
})->name('kirim'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="{{ app()->getLocale() }}"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Laravel</title> | |
<!-- Fonts --> | |
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css"> | |
<!-- Styles --> | |
<style> | |
html, body { | |
background-color: #fff; | |
color: #636b6f; | |
font-family: 'Raleway', sans-serif; | |
font-weight: 100; | |
height: 100vh; | |
margin: 0; | |
} | |
.full-height { | |
height: 100vh; | |
} | |
.flex-center { | |
align-items: center; | |
display: flex; | |
justify-content: center; | |
} | |
.position-ref { | |
position: relative; | |
} | |
.top-right { | |
position: absolute; | |
right: 10px; | |
top: 18px; | |
} | |
.content { | |
text-align: center; | |
} | |
.title { | |
font-size: 54px; | |
} | |
.title small { | |
font-size: 20px; | |
} | |
.links > a { | |
color: #636b6f; | |
padding: 0 25px; | |
font-size: 12px; | |
font-weight: 600; | |
letter-spacing: .1rem; | |
text-decoration: none; | |
text-transform: uppercase; | |
} | |
.m-b-md { | |
margin-bottom: 30px; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="flex-center position-ref full-height"> | |
@if (Route::has('login')) | |
<div class="top-right links"> | |
@if (Auth::check()) | |
<a href="{{ url('/home') }}">Home</a> | |
@else | |
<a href="{{ url('/login') }}">Login</a> | |
<a href="{{ url('/register') }}">Register</a> | |
@endif | |
</div> | |
@endif | |
<div class="content"> | |
<div class="title m-b-md"> | |
SendGrid Test | |
<br> | |
<small>Made with ♥ by Oktavianto.id</small> | |
</div> | |
<div class="links"> | |
<form action="{{ route('kirim') }}" method="POST"> | |
{{ csrf_field() }} | |
<div> | |
<p>Tulis Pesan</p> | |
<textarea type="text" name="message"></textarea> | |
</div> | |
<div> | |
<p>Email</p> | |
<input type="email" name="email"> | |
<input type="submit" value="Kirim"> | |
</div> | |
</form> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment