Andreas94's avatar

email not sended with namecheap

Hi, I installed laravel correctly in a namecheap shared-hosting, I'm trying to see if Laravel's "reset password" it's work, but I do not get the email.

This is my configuration in .env

MAIL_DRIVER=smtp
MAIL_HOST=mail.domain.ext
MAIL_PORT=465
[email protected]
MAIL_PASSWORD=password

my mail.php:

    'driver' => env('MAIL_DRIVER'),
    'host' => env('MAIL_HOST'),
    'port' => env('MAIL_PORT'),
    'from' => [
        'address' => env('MAIL_FROM_ADDRESS', '[email protected]'),
        'name' => env('MAIL_FROM_NAME', 'Example'),
    ],
    'encryption' => env('MAIL_ENCRYPTION', 'tls'),
    'username' => env('MAIL_USERNAME'),
    'password' => env('MAIL_PASSWORD'),
    'sendmail' => '/usr/sbin/sendmail -bs',

where am I wrong? I checked in the storage / log and I have no log...

0 likes
9 replies
Thyrosis's avatar

If you're on a shared host, contact their support team to check the servers mail logs. Provide them with a test script they can access so they can check whether the mails are actually offered to the mailserver to be sent.

Usually they get stuck in outgoing or incoming filter due to some missing formatting or incorrect headers.

Andreas94's avatar

Thanks for the reply. I will follow your advice. But I noticed in the debugbar that when I try to apply for a new password, it signals this error: https://image.ibb.co/bUwMMR/error.png

and if I try to send an email with tinker, this is the answer:

Mail::send('errors.503', [], function($message) { $message->to('****@gmail.com')->subject('test');}); => null

tisuchi's avatar

Which version of laravel you are using?

Can you show your email sending code?

Andreas94's avatar

Hi, I'm using Laravel 5.4, i have installed guzzlehttp/guzzle and now with tinker the email is sent, but keep on using mailgun.org and not smtp...

What email code would you like to see? I'm using the laravel authentication system...

tisuchi's avatar

I see.. Since you are using laravel auth, I suggest you to create a simple email and trigger to you. Than you will know whether its problem in your code, or in api side.

tisuchi's avatar

I see, here is the problem.

The tutorial you are following is not based on laravel 5.4. It may be in laravel 5.2

So, the structure of email in laravel 5.2 and 5.4 are different. So that, it might not trigger email.

So, just follow this documentation, that is straight forward for you to implement. https://laravel.com/docs/5.4/mail

1 like
Andreas94's avatar

Sorry but I really do not understand, But then the password reset email system was not created, and should I create it manually?

Because although the guide is for Laravel 5.2, it works equally.

Andreas94's avatar
Andreas94
OP
Best Answer
Level 2

I'm trying it all locally with XAMPP, I configured it with mailtrap, I put that when one registers receives a welcome email, and the email is received correctly.

my code:

env

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=d6d2dexxxxf1c3
MAIL_PASSWORD=c509caxxxx7def1
MAIL_ENCRYPTION=tls

and for send the email, i have using in RegisterController:

Mail::to($user->email)->send(new Welcome);

but the reset password does not work... But this feature is to write to us, or is it already integrated into laravel's auth system?

edit: Solved was a stupid routing mistake

Please or to participate in this conversation.