samedi 3 septembre 2016

mailgun and laravel 5.1 issues sending mail / configuring

hey guys trying to send mail with mailgun using laravel 5.1 and nothing seems to be working heres what i have

I'm using laravel AuthController right out of the box with some adjustments below

/**
 * Create a new user instance after a valid registration.
 *
 * @param  array  $data
 * @return User
 */
protected function create(array $data) {
    return User::create([
        'name' => $data['name'],
        'email' => $data['email'],
        'password' => bcrypt($data['password']),
    ]);

    mt_srand((double)microtime()*15000);//optional for php 4.2.0 and up.
    $charid = strtoupper(md5(uniqid(rand(), true)));
    $uuid = substr($charid, 0, 8)
    .substr($charid, 8, 4)
    .substr($charid,12, 4)
    .substr($charid,16, 4)
    .substr($charid,20,12);

    $data['confirmationLink'] = $uuid;
    //dd($uuid);
    Mail::send('emails.confirm', $data, function ($m) {
        $m->from('support@support.com', 'Your Application');
        $m->to($data['email'])->subject('Welcome to support.com');
    });

my emails.confirm file located in my views directory

and here is my .env file

MAIL_DRIVER=mailgun
MAIL_HOST=smtp.mailgun.org
MAIL_PORT=2525
MAIL_USERNAME=postmaster@support.com
MAIL_PASSWORD=1111112312312312321321312
MAIL_ENCRYPTION=null

and last config/services.php

'mailgun' => [
    'domain' => env('http://ift.tt/2bJzHb7'),
    'secret' => env('key-11111111111111spoof'),
],

so im not sure if its my code or my configuration, thanks for all the help



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire