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

Any example ? It does not tell much honestly.

0

if($validator->passes()) {
$response = Mail::send('emails.contact',$data, function($message) use($data,$carName,$num) { $message->from(Config::get('mail.from.address'), Config::get('mail.from.name')); $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

0

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.

0

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.

0

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
});
0

thank you very much zaalbarxx.. ill do it .

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Pat-Paran pat-paran Joined 10 Dec 2014

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.