I'm trying to send a basic verification email using Laravel and an account on mailgun.com. I've followed the instructions here and am getting errors. here's my code:
public function postCreate(){
$validator = Validator::make(Input::all(),
array(
'email' => 'required|max:50|email|unique:users',
'username' => 'required|alpha_dash|max:60|min:3|unique:users',
'password' => 'required|min:6',
'password_again' => 'required|same:password'
)
);
if($validator->fails()){
return Redirect::route('account-create')
->withErrors($validator)
->withInput();
} else {
// Create Account
$email = Input::get('email');
$username = Input::get('username');
$password = Input::get('password');
// Activation Code
$code = str_random(60);
$user = User::create(array(
'email' => $email,
'username' => $username,
'password' => $password,
'password' => Hash::make($password),
'code' => $code,
'active' => 0
));
if($user){
// Send Email
Mail::send('emails.auth.activate', array('link' => URL::route('account-activate', $code), 'username' => $username), function($message) use ($user) {
$message->to($user->email, $user->username)->subject('Acivate Your Account');
});
return Redirect::route('home')
->with('global', 'Your account has been created. We have sent you an email to activate your account');
}
}
}
My Error Message
Client error response [url] https://api.mailgun.net/v2/mydomain.com/messages.mime [status code] 404 [reason phrase] NOT FOUND