2016-04-12 29 views
0

Her gün otomatik olarak bir e-posta göndermek için bir komut oluşturuyorum.E-posta gönderme komutu oluşturma - Laravel 5.2

Böyle komutu kuruyorum: Böyle

<?php 

namespace App\Console\Commands; 

use Illuminate\Console\Command; 
use Illuminate\Support\Facades\Mail; 

class SendEmail extends Command 
{ 
    protected $signature = 'emails:send'; 

    protected $description = 'Sending emails to the users.'; 

    public function __construct() 
    { 
     parent::__construct(); 
    } 

    public function handle() 
    { 
     $data = array(
      'name' => "МГ 'Константин Величков', гр. Пазарджик", 
     ); 

     Mail::send('emails.test', $data, function ($message) { 

      $message->from('[email protected]', 'МГ "Константин Величков"'); 

      $message->to('[email protected]')->subject('Оценки'); 

     }); 
     $this->info('The emails are send successfully!'); 
    } 
} 

Sonra Çekirdeği'nde kaydetmek:

<?php 

namespace App\Console; 



use Illuminate\Console\Scheduling\Schedule; 
use Illuminate\Foundation\Console\Kernel as ConsoleKernel; 

class Kernel extends ConsoleKernel 
{ 
    protected $commands = [ 
     Commands\Inspire::class, 
     Commands\SendEmail::class, 
    ]; 

    protected function schedule(Schedule $schedule) 
    { 
     $schedule->command('emails:send')->daily(); 
    } 
} 

Bütün esnaf komutları listeleyen ediyorum ve benim yeni COMAND görebilirsiniz

[Swift_TransportException] 
    Process could not be started [The system cannot find the path specified. 
    ] 
: -: e-postalar bu nedenle onun yarattığı, ama o (php artisan emails:send) çalıştırmayı denediğinizde ben bu got göndermekSorun nedir?
+0

'$ transport = Swift_MailTransport :: newInstance();' –

+0

Ve bunu nereye koydum? –

cevap

1

Görünüşe göre Gmail e-posta göndermeyi engelliyor veya ortamınız bağlantıyı engelliyor.

Gmail hesabınızın kilidini açmak için this address adresine gidin. Ayrıca, sunucunuzdaki güvenlik duvarı ayarlarını kontrol edin.

+0

Hesabımı açarım ama bu yardımcı olmuyor. Bu güvenlik duvarı ayarlarını nasıl kontrol edebilirim? –

+0

Hangi ortamı kullanıyorsunuz (Homestead, XAMPP veya Linux/Windows sunucusu)? –

+0

XAMPP, ancak şimdi paylaşılan ana bilgisayarda –