Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialShane McC
3,005 PointsLaravel Error Message When Sending Email
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
2 Answers
thomascawthorn
22,986 PointsCan you show us your config/services.php and config/mail.php files?
Shane McC
3,005 Points+Tom Cawthorn, thanks this fixed the issue.
Shane McC
3,005 PointsShane McC
3,005 PointsTom Cawthorn
config/services.php return array(
config/mail.php
thomascawthorn
22,986 Pointsthomascawthorn
22,986 PointsI imagine you already have done.. but just to make sure - this content here:
is replacing actual content?