user2755140
user2755140

Reputation: 2027

I'm not able to send mail via mailgun using Laravel

I'm facing an issue to send email. I have my website built with Laravel. I have the files set up properly. That happens in 2 files.

The first one contains "driver" which of course is mailgun, "host" (smtp.mailgun.org), "port" (587 and according to my provider it's opened), "encryption" (tls), "username" and "password" (both with the right values).

The second one contains "domain" and "secret" (also both with the right values).

The domain is not the mailgun domain but my own domain, which is ACTIVE after set the Domain Verification and DNS.

The mailgun domain is still there ACTIVE. I don't know if I have to remove it or something. I really don't know what I'm missing here.


IMPORTANT UPDATE

Class 'GuzzleHttp\Client' not found

I'm receiving that message


mail.php

return array(

    'driver' => 'mailgun',

    'host' => 'smtp.mailgun.org',

    'port' => 587,

    'from' => array('address' => '[email protected]', 'name' => 'xxxxxxx'),

    'encryption' => 'tls',

    'username' => "xxxxxxxxxxxxxx",

    'password' => "xxxxxxxxxxxxxx",

    'sendmail' => '/usr/sbin/sendmail -bs',

    'pretend' => false,

);

Obviously, the xxxxxxxxxx are my personal data. I can assure I'm setting the right values. It should work, indeed. :(

services.php

return array(

    'mailgun' => array(
        'domain' => 'domain-here',
        'secret' => 'key-here',
    ),

    'mandrill' => array(
        'secret' => '',
    ),

    'stripe' => array(
        'model'  => 'User',
        'secret' => '',
    ),

);

domain and secret are populated with the right values too.

Upvotes: 0

Views: 1439

Answers (2)

manix
manix

Reputation: 14747

Try to require guzzle dependency directly.

  1. Add "guzzle/guzzle": "~3.9@dev" to composer.json like, example:

    "require": {
        "laravel/framework": "5.0.*",
        "guzzle/guzzle": "~4.0"
    },
    
  2. Update your project. The command below shoul be executed in a terminal/console. For example, if your laravel application is hosted in a windows machine, you do:

    > cd project/folder/path // change the working path
    > composer update // this command update the proyect and dependencies
    

    If you laravel is hosteed in a linux machine the you do:

    $ cd /path/a/mi/folder   // change the working path
    $ composer update   // this command update the proyect and dependencies
    
  3. Test again your application

Upvotes: 1

user2755140
user2755140

Reputation: 2027

The @manix suggestion it seems to be the right approach but the version suggested 3.9 is deprecated. So it should be:

"guzzlehttp/guzzle": "~4.0"

As I have the project built with Laravel 4.2.

It should be 5.0 for Laravel 5.0.

Upvotes: 1

Related Questions