Support the ongoing development of Laravel.io →
Configuration Forms Mail

I'm using Laravel 5.0 for my project and i have to send mail to admin whenever user submits a contact us form. The mail functionality was working fine in my local but when i moved to production server (CENTOS) it was not working. PHP mail() is working but laravel mail(), not able to get what is happening.

    $sent = Mail::raw('plain text message', function ($message) {
         $message->from('gbhyri@gmail.com', 'bhyri');

          $message->to('gayatri.bhyri@gmail.com', 'gayatri');

          $message->subject('Subject');
    });
    dd($sent);

I'm getting 0 as ouput,

When i run dd(Mail::failures)
getting as array:1 [▼ 0 => "gayatri.bhyri@gmail.com" ]

Don't know what is happening... Any suggestions were I'm missing...

Last updated 3 years ago.
0

did you take a look at the postfix log ?

you might wanna install postfix if it's not https://www.digitalocean.com/community/tutorials/how-to-install-postfix-on-centos-6

0

May be the issue with you setting up you 'MAIL_DRIVER'. Please re check it. MAIL_DRIVER should be "mailgun" and try with MAIL_PRETEND to false. You can see in detail here

Let me know if you still facing the same.

0

Hi, Thanks for your reply. i'm not suppose to use any API's, so using laravel mail::send() for emails as a driver mail.

0

Sign in to participate in this thread!

PHPverse

Your banner here too?

gbhyri gbhyri Joined 24 Nov 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.