riyas's avatar

Mail function giving an "Allowed memory exhausted" error

Hello,

While using the mail function, i am getting below error "Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 130968 bytes) in /webprojects/myproject/vendor/illuminate/container/Container.php on line 366"

below is my code

use App\Http\Controllers\Controller; use Illuminate\Http\Request; use App\Subscriptions; use Illuminate\Contracts\Mail\Mailer as MailerContract; use DB;

class SubscriptionCreateNotificationControllerTest extends Controller {

/** 
 * Hold the default request.
 */
protected $request;


/** 
 * Hold the default request.
 */
protected $process;


/**
 * The mailer instance.
 *
 * @var \Illuminate\Contracts\Mail\Mailer
 */
protected $mailer;


/**
 * Create a new controller instance.
 *
 * @return void
 */
 
public function __construct(Request $request,  MailerContract $mailer)
{
    $this->request = $request;      
    $this->mailer = $mailer;        
} 
    

public function index(){
            
    
    $this->mailer->send('emails.subscription_welcome', ['key' => ['customer_fname' => 'aaa']], function($message){
                        $message->to('me@example.com')->subject(' Symantec - Your account details' );                       
                    });
    
            
    
    exit();
}   

}

Any idea?

0 likes
3 replies
jimmck's avatar

PHP has run of heap space because of recursion. Did you increase your max callback count?

riyas's avatar

Thanks for quick reply

We identified the issue. It was because storage/view folder didn't have enough file permissions

Please or to participate in this conversation.