Support the ongoing development of →
Eloquent Forms Mail
Last updated 2 years ago.

Any example ? It does not tell much honestly.


if($validator->passes()) {
$response = Mail::send('',$data, function($message) use($data,$carName,$num) { $message->from(Config::get('mail.from.address'), Config::get('')); $message->to(Config::get('mail.from.address'))->subject('Enquiry '.date('Y-m-d ').'Car name: '. $carName.'count: '. $counter);;

is there any way to implement my $counter variable? i want to display it in the subject of the email. Thank you zaalbarxx


What is this counter counting itself ? All I see is you are trying to send an email somewhere with some $counter in the subject. You could create an event listener which would listen for mail.sent and take some arguments you need and then increment some value in database for given e-mail. Then you would have access to this counter. Still I am not sure if this is what you are thinking about.


yup you got it but is there a way for me not to use database for the counter . for example i will build a global variable then it increments whenever there is an email send.


You mean you want to count the number of all emails sent within one particular request ? You can then listen to event like :

Event::listen('mailer.sending', function($message){ //$message is not neccessary, but you may want it
    //do something to persist the counter, may be some singleton or even session

thank you very much zaalbarxx.. ill do it .


Sign in to participate in this thread!


Your banner here too?

Pat-Paran pat-paran Joined 10 Dec 2014


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.