2017-04-15 29 views
0

我已經安裝了laravel包在用戶認證Laravel的Mail ::發送本地Apache的作品,但抱怨啞劇上nginx的

https://github.com/jrean/laravel-user-verification

註冊控制器需要改變工作如下圖所示。

public function register(Request $request) 
{ 
    $this->validator($request->all())->validate(); 

    $user = $this->create($request->all()); 
    $this->guard()->login($user); 

    UserVerification::generate($user); 
    UserVerification::send($user, 'Verification Mail from example.com'); 
    return redirect()->intended('/home'); 
} 

使用mailgun發送郵件。它在本地apache上運行良好。成功發送郵件給Gmail和其他人。

安裝在nginx製作(ubuntu 16.04 VPS)上。它引發以下錯誤。

FatalThrowableError in SimpleMessage.php line 33: 
Type error: Argument 1 passed to Swift_Mime_SimpleMessage::__construct() must 
be an instance of Swift_Mime_HeaderSet, none given, called in /var/www/example.com/ 
html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Message.php on line 48 

要檢查它是否是包問題我也做了以下工作在本地apache但在nginx上引發同樣的錯誤。

Route::get('/mailsend', function() { 

$data = [ 
    'title' => 'hello user', 
    'content' => 'Thanks for joining us' 
]; 

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

    $message->to('[email protected]','example')->subject('Testing from example'); 
}); 

}); 

如圖誤差/Swift/Message.php在管線48的代碼如下

call_user_func_array(
    array($this, 'Swift_Mime_SimpleMessage::__construct'), 
    Swift_DependencyContainer::getInstance() 
     ->createDependenciesFor('mime.message') 
    ); 

無法找出與nginx的問題。任何幫助將不勝感激。

回答

0

嘗試取消註釋行:在的php.ini

延長= php_openssl.dll,並檢查該https://laravel.io/forum/05-13-2014-smtp-mail-not-working-in-live-server

+0

我的服務器是Ubuntu的服務器。這裏沒有任何權力。我猜測它是更多的nginx傳遞$ header到SimpleMessage.php。 – avinash

+0

對不起我的錯誤,但你應該對這個php_openssl感興趣。訪問https://askubuntu.com/questions/323005/php-openssl-extension-has-a-package –

相關問題