{"id":32735,"date":"2026-11-29T22:05:39","date_gmt":"2026-11-29T22:05:39","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=32735"},"modified":"2026-11-29T22:05:39","modified_gmt":"2026-11-29T22:05:39","slug":"how-to-see-number-of-emails-sent-using-smtp-in-laravel","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/how-to-see-number-of-emails-sent-using-smtp-in-laravel\/","title":{"rendered":"How to see number of emails sent using smtp in laravel"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Laravel does not count or log SMTP emails by default, so a grep will only return a real number once your application writes one log line for each message sent. This guide shows how to log every sent email with Laravel&#039;s <code>MessageSent<\/code> event, count those lines with <code>grep<\/code>, track failed sends separately and check the figure against your SMTP provider. It also explains why the commands above can give misleading numbers.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To see the number of emails sent using SMTP in Laravel, you can look for log entries in your Laravel application&#8217;s logs that indicate email messages have been sent.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, you could use the following command to search for log entries containing the string &#8220;Sent Email&#8221; in the file &#8220;laravel.log&#8221;:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ cd \/opt\/lampp\/htdocs\n$ <code>grep -c \"Sent Email\" laravel.log\n<\/code>$ grep -r -i --include=\"*.log\" -o \"smtp\" . | wc -l\n$ grep -r --include=\"*.log\" -o \"email-smtp.ap-south-1.amazonaws.com\" . | wc -l<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Explanation:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>grep<\/code> searches for the specified string in the file<\/li>\n\n\n\n<li><code>-c<\/code> flag only prints the count of matching lines, rather than the lines themselves<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">This command will give you a count of the number of log entries containing the string &#8220;Sent Email&#8221;, which would indicate that an email was sent.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">What the commands above actually count<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Each command in the example above searches for a string. None of them counts emails unless your application writes that string once for each email. With <code>MAIL_MAILER=smtp<\/code>, Laravel writes nothing to the log when a message is sent successfully. In practice, the SMTP host name usually appears in the log only when something goes wrong.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Command<\/th><th>What it really counts<\/th><th>Problem<\/th><\/tr><\/thead><tbody><tr><td><code>grep -c &quot;Sent Email&quot; laravel.log<\/code><\/td><td>Lines containing the text <code>Sent Email<\/code><\/td><td>Laravel never writes this text itself, so the result is 0 unless your code logs it<\/td><\/tr><tr><td><code>grep -r -i -o &quot;smtp&quot; . | wc -l<\/code><\/td><td>Every time <code>smtp<\/code> appears in any <code>.log<\/code> file below the current directory<\/td><td>Also matches config dumps, error messages and stack traces, and searches every project under <code>htdocs<\/code><\/td><\/tr><tr><td><code>grep -r -o &quot;email-smtp.ap-south-1.amazonaws.com&quot; . | wc -l<\/code><\/td><td>Every time the SES host name appears<\/td><td>The host name is mostly logged in connection and authentication errors, so this tends to count failures, not sends<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> <code>-o<\/code> combined with <code>wc -l<\/code> counts matches, not log entries. One failed send can produce a stack trace that mentions the host several times, so one failure can add several to the count.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Where Laravel writes its logs<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Application logs are written to <code>storage\/logs<\/code> inside the project, not to the web root. With the default <code>single<\/code> channel the file is <code>storage\/logs\/laravel.log<\/code>. With the <code>daily<\/code> channel there is one file per day, such as <code>laravel-2026-11-29.log<\/code>. The <code>LOG_CHANNEL<\/code> (and <code>LOG_STACK<\/code>) values in <code>.env<\/code> decide which applies.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">cd \/opt\/lampp\/htdocs\/your-project\nls -lh storage\/logs\/\ngrep -E <span class=\"hljs-string\">'^(MAIL_|LOG_)'<\/span> .env<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">Check that <code>MAIL_MAILER<\/code> is <code>smtp<\/code> in the environment you are measuring. Laravel versions before 7 use <code>MAIL_DRIVER<\/code> instead. If it is set to <code>log<\/code>, messages are written to the log file and never sent. If it is set to <code>array<\/code>, they are only held in memory.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Log every sent email with the MessageSent event<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Laravel fires <code>Illuminate\\Mail\\Events\\MessageSent<\/code> after the mailer hands a message to the transport. For SMTP, that means after the server accepts it. Queued mail fires the event in the queue worker when the message actually goes out, not when it is queued. A listener for this event gives you exactly one log line for each accepted message.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First, add a dedicated log channel to the <code>channels<\/code> array in <code>config\/logging.php<\/code>. This keeps mail lines separate from application noise:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-string\">'mail'<\/span> =&gt; &#91;\n    <span class=\"hljs-string\">'driver'<\/span> =&gt; <span class=\"hljs-string\">'daily'<\/span>,\n    <span class=\"hljs-string\">'path'<\/span> =&gt; storage_path(<span class=\"hljs-string\">'logs\/mail.log'<\/span>),\n    <span class=\"hljs-string\">'level'<\/span> =&gt; <span class=\"hljs-string\">'info'<\/span>,\n    <span class=\"hljs-string\">'days'<\/span> =&gt; <span class=\"hljs-number\">90<\/span>,\n],<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">Then create the listener with <code>php artisan make:listener LogSentMessage --event=MessageSent<\/code> and replace its contents:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"><span class=\"php\"><span class=\"hljs-meta\">&lt;?php<\/span>\n\n<span class=\"hljs-keyword\">namespace<\/span> <span class=\"hljs-title\">App<\/span>\\<span class=\"hljs-title\">Listeners<\/span>;\n\n<span class=\"hljs-keyword\">use<\/span> <span class=\"hljs-title\">Illuminate<\/span>\\<span class=\"hljs-title\">Mail<\/span>\\<span class=\"hljs-title\">Events<\/span>\\<span class=\"hljs-title\">MessageSent<\/span>;\n<span class=\"hljs-keyword\">use<\/span> <span class=\"hljs-title\">Illuminate<\/span>\\<span class=\"hljs-title\">Support<\/span>\\<span class=\"hljs-title\">Facades<\/span>\\<span class=\"hljs-title\">Log<\/span>;\n\n<span class=\"hljs-class\"><span class=\"hljs-keyword\">class<\/span> <span class=\"hljs-title\">LogSentMessage<\/span>\n<\/span>{\n    <span class=\"hljs-keyword\">public<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">handle<\/span><span class=\"hljs-params\">(MessageSent $event)<\/span>: <span class=\"hljs-title\">void<\/span>\n    <\/span>{\n        $message = $event-&gt;message; <span class=\"hljs-comment\">\/\/ Symfony\\Component\\Mime\\Email (Laravel 9+)<\/span>\n\n        Log::channel(<span class=\"hljs-string\">'mail'<\/span>)-&gt;info(<span class=\"hljs-string\">'Sent Email'<\/span>, &#91;\n            <span class=\"hljs-string\">'to'<\/span>         =&gt; collect($message-&gt;getTo())-&gt;map-&gt;getAddress()-&gt;implode(<span class=\"hljs-string\">','<\/span>),\n            <span class=\"hljs-string\">'subject'<\/span>    =&gt; $message-&gt;getSubject(),\n            <span class=\"hljs-string\">'message_id'<\/span> =&gt; $event-&gt;sent-&gt;getMessageId(),\n        ]);\n    }\n}<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">In Laravel 11 and later, listeners in <code>app\/Listeners<\/code> are discovered automatically from the type-hinted event. In Laravel 10 and earlier, register the listener in <code>app\/Providers\/EventServiceProvider.php<\/code>:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-keyword\">protected<\/span> $listen = &#91;\n    \\Illuminate\\Mail\\Events\\MessageSent::class =&gt; &#91;\n        \\App\\Listeners\\LogSentMessage::class,\n    ],\n];<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">The listener uses Symfony Mailer methods, which Laravel uses from version 9. Laravel 8 and earlier use SwiftMailer, so the listener needs SwiftMailer equivalents there. Laravel 8 does fire <code>MessageSent<\/code>, but <code>$event-&gt;sent<\/code> does not exist, so the <code>message_id<\/code> line will fail.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Clear cached configuration and events, confirm the listener is registered and send a test message:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">php artisan optimize:clear\nphp artisan event:<span class=\"hljs-keyword\">list<\/span> | grep -A1 MessageSent\nphp artisan tinker --execute=<span class=\"hljs-string\">\"Mail::raw('Test', fn (\\$m) =&gt; \\$m-&gt;to('you@example.com')-&gt;subject('SMTP test'));\"<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">Each email adds one line like this to <code>storage\/logs\/mail-YYYY-MM-DD.log<\/code>:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">&#91;<span class=\"hljs-number\">2026<\/span><span class=\"hljs-number\">-11<\/span><span class=\"hljs-number\">-29<\/span> <span class=\"hljs-number\">10<\/span>:<span class=\"hljs-number\">15<\/span>:<span class=\"hljs-number\">02<\/span>] production.INFO: Sent Email {<span class=\"hljs-string\">\"to\"<\/span>:<span class=\"hljs-string\">\"you@example.com\"<\/span>,<span class=\"hljs-string\">\"subject\"<\/span>:<span class=\"hljs-string\">\"SMTP test\"<\/span>,<span class=\"hljs-string\">\"message_id\"<\/span>:<span class=\"hljs-string\">\"0109018f...@email.amazonses.com\"<\/span>}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\">Count sent emails with grep<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Each log line now stands for one email. Leave out <code>-o<\/code>, because <code>-c<\/code> already counts matching lines. When you give <code>grep -c<\/code> several files, it prints one count per file. Use <code>-h<\/code> with <code>wc -l<\/code> to get a single total.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">cd \/opt\/lampp\/htdocs\/your-project\n\n<span class=\"hljs-comment\"># Today<\/span>\ngrep -c <span class=\"hljs-string\">\"Sent Email\"<\/span> storage\/logs\/mail-$(date +%F).log\n\n<span class=\"hljs-comment\"># Total across all retained mail logs<\/span>\ngrep -h <span class=\"hljs-string\">\"Sent Email\"<\/span> storage\/logs\/mail-*.log | wc -l\n\n<span class=\"hljs-comment\"># Count per day<\/span>\ngrep -h <span class=\"hljs-string\">\"Sent Email\"<\/span> storage\/logs\/mail-*.log | cut -c2<span class=\"hljs-number\">-11<\/span> | sort | uniq -c\n\n<span class=\"hljs-comment\"># Count per hour for one day<\/span>\ngrep -h <span class=\"hljs-string\">\"Sent Email\"<\/span> storage\/logs\/mail<span class=\"hljs-number\">-2026<\/span><span class=\"hljs-number\">-11<\/span><span class=\"hljs-number\">-29.<\/span>log | cut -c2<span class=\"hljs-number\">-14<\/span> | sort | uniq -c\n\n<span class=\"hljs-comment\"># Emails sent to one recipient<\/span>\ngrep -h <span class=\"hljs-string\">\"Sent Email\"<\/span> storage\/logs\/mail-*.log | grep -c <span class=\"hljs-string\">'\"to\":\"user@example.com'<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">The per-day command prints output like the following. The count comes first, then the date:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">    412 2026-11-27\n    389 2026-11-28\n    157 2026-11-29<\/code><\/span><\/pre>\n\n\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> If logrotate compresses old files, use <code>zgrep -h &quot;Sent Email&quot; storage\/logs\/mail-*.log* | wc -l<\/code> so the <code>.gz<\/code> files are counted as well.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Track failed sends separately<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Failed SMTP sends throw a <code>Symfony\\Component\\Mailer\\Exception\\TransportException<\/code>. If nothing catches it, Laravel logs it to the default channel, and for queued mail the job ends up in <code>failed_jobs<\/code>. Search for the exception class, not the host name. Errors come with stack traces, so count only the lines that start a log entry:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-comment\"># Logged transport errors<\/span>\ngrep -h <span class=\"hljs-string\">\"TransportException\"<\/span> storage\/logs\/laravel*.log | grep -c <span class=\"hljs-string\">'^\\&#91;'<\/span>\n\n<span class=\"hljs-comment\"># Typical messages behind those errors<\/span>\ngrep -hoE <span class=\"hljs-string\">\"Connection could not be established&#91;^\\\"]*|Expected response code &#91;0-9]+&#91;^\\\"]{0,80}\"<\/span> storage\/logs\/laravel*.log | sort | uniq -c | sort -rn | head\n\n<span class=\"hljs-comment\"># Queued mail that failed<\/span>\nphp artisan queue:failed<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\">Cross-check with your SMTP provider<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A <code>MessageSent<\/code> line means the SMTP server accepted the message. It does not mean the message was delivered. Bounces, complaints and rejections happen after acceptance, so check the provider&#039;s own figures as well. For Amazon SES, which the <code>email-smtp.ap-south-1.amazonaws.com<\/code> host in the example above belongs to, the CLI returns delivery attempts, bounces, complaints and rejects for roughly the last two weeks, in 15-minute data points:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">aws ses <span class=\"hljs-keyword\">get<\/span>-send-statistics --region ap-south-1 \\\n  --query 'sum(SendDataPoints&#91;].DeliveryAttempts)'<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">If this number is much higher than your log count, other applications or servers are probably using the same SES identity or SMTP credentials. If it is lower, check whether <code>MAIL_MAILER<\/code> points somewhere else in one of your environments.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Corrected version of the original commands<\/h2>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-comment\"># Run from the project root, not the XAMPP web root<\/span>\ncd \/opt\/lampp\/htdocs\/your-project\n\n<span class=\"hljs-comment\"># Requires the MessageSent listener shown above<\/span>\ngrep -h <span class=\"hljs-string\">\"Sent Email\"<\/span> storage\/logs\/mail-*.log | wc -l\n\n<span class=\"hljs-comment\"># Failures, counted once per log entry<\/span>\ngrep -h <span class=\"hljs-string\">\"TransportException\"<\/span> storage\/logs\/laravel*.log | grep -c <span class=\"hljs-string\">'^\\&#91;'<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<ul class=\"wp-block-list\">\n<li>The project path now ends at the application folder, so only that application&#039;s <code>storage\/logs<\/code> is searched.<\/li>\n\n\n<li>The string <code>Sent Email<\/code> is produced by the listener, so the count means something.<\/li>\n\n\n<li>The <code>smtp<\/code> and host-name searches are dropped as send counters, because they match error messages and stack traces.<\/li>\n\n\n<li><code>-o | wc -l<\/code> is replaced by line counts, so each email or failure is counted once.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Best practices<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Log only metadata (recipient, subject, message ID). Never log message bodies, attachments or SMTP credentials.<\/li>\n\n\n<li>Recipient addresses are personal data. Set <code>days<\/code> on the mail channel to a retention period your privacy policy allows.<\/li>\n\n\n<li>If you need reports or dashboards, write a row to a database table from the same listener instead of parsing logs. Counting with SQL is faster and survives log rotation.<\/li>\n\n\n<li>Keep <code>MAIL_MAILER=log<\/code> in local and staging environments so test mail does not inflate production SES statistics.<\/li>\n\n\n<li>Run queue workers under a process supervisor so queued mail is actually sent and logged.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently asked questions<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Does Laravel log sent emails by default?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">No. With the <code>smtp<\/code> mailer, a successful send writes nothing to <code>laravel.log<\/code>. The <code>log<\/code> mailer writes the full message to the log instead of sending it. To record real sends, listen for the <code>MessageSent<\/code> event.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Where is the Laravel log file located?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">It is in the project&#039;s <code>storage\/logs<\/code> directory. With the <code>single<\/code> channel the file is <code>laravel.log<\/code>, and with the <code>daily<\/code> channel the files are named by date, such as <code>laravel-2026-11-29.log<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Does MessageSent mean the email was delivered?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">No. It means the SMTP server accepted the message. Delivery, bounces and complaints are only visible in the provider&#039;s statistics or through its event notifications.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How do I count queued emails in Laravel?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>MessageSent<\/code> listener handles them. The event fires in the queue worker when the message is actually sent, so queued and synchronous mail are both logged once. Failed queued mail appears in <code>php artisan queue:failed<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Why does grep -c give per-file counts instead of a total?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">When <code>grep -c<\/code> searches several files, it prints one count per file. Use <code>grep -h &quot;pattern&quot; files | wc -l<\/code> to get a single total.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Related tutorials<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.devopsschool.com\/blog\/category\/programming\/php\/laravel\/\">More Laravel tutorials<\/a><\/li>\n\n\n<li><a href=\"https:\/\/www.devopsschool.com\/blog\/what-is-laravel-and-use-cases-of-laravel\/\">What is Laravel and use cases of Laravel?<\/a><\/li>\n\n\n<li><a href=\"https:\/\/www.devopsschool.com\/blog\/top-100-laravel-interview-questions-and-answers\/\">Top 100 laravel interview questions and answers<\/a><\/li>\n\n\n<li><a href=\"https:\/\/www.devopsschool.com\/blog\/step-by-step-tutorial-dynamic-container-url-routing-using-apache-xampp-for-multi-user-laravel-app\/\">Step-by-Step Tutorial: Dynamic Container URL Routing using Apache (XAMPP) for Multi-User Laravel App<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Laravel does not count or log SMTP emails by default, so a grep will only return a real number once your application writes one log line for&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[5201],"tags":[475,488],"class_list":["post-32735","post","type-post","status-publish","format-standard","hentry","category-laravel","tag-grep","tag-smtp"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/32735","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=32735"}],"version-history":[{"count":4,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/32735\/revisions"}],"predecessor-version":[{"id":80420,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/32735\/revisions\/80420"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=32735"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=32735"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=32735"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}