Mail Not working in laravel console command handle function - php

Mail Not working in laravel console command handle function in laravel 7. I want to develop an auto email function with laravel schedule. So I used laravel email in console command handle function. Mail system does not work properly in console command handle function but it works in other. So could you please help me anyone? Why don't work laravel mail system within Console Command handle function.Thanks.

Related

Why is Laravel using a different mail driver for queued e-mails?

In development mode, I was using mailtrap to test e-mails. Bulk e-mails were working fine too with queues. When I moved my application to production mode, I was unable to send bulk e-mails using the queue.
When I tried to use my production mail driver SparkPost in development mode to check if something is wrong with e-mails, I found that I was able to send e-mails directly. E-mails like password resets were working fine. But when I tried to send bulk e-mails, I was receiving e-mails in the Mailtrap inbox. I cleared the cache using php artisan cache:clear but I am still getting e-mails in the Mailtrap inbox while I am using SparkPost credentials in my .env file and also mail.php file.
Here is my .env file:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.sparkpostmail.com
MAIL_PORT=587
MAIL_USERNAME=SMTP_Injection
MAIL_PASSWORD=MY_SECRET_LITTLE_KEY
The only mention of smtp.mailtrap.io is in .env.example file. I looked for this host recursively in my whole directory.
Try restarting your laravel queue. The laravel queues caches the config when first starting and doesn't check for further changes, unless it's manually restarted.
You can do that using php artisan queue:restart
See more details in the official docs

Php script for fcm

I am developing an android app implementing FCM. For testing purpose I need to implement my own script to send data.I am using linux and I am quite naive about server side implementation. I have a php script which is supposed to send data.It is on localhost.So what do I need to do to run the script. Do I need to bind my localhost to my IP .?? Also how do I know if my script has successfully send data.Right now I am not getting any error. I am using command line php -f var/www/html/filename. Thanks

Server/Laravel 5.1 - Mail storage?

So I developed an application with laravel and everything is running fine. I had mail as my mail driver but my server was misconfigured, or let's say, postfix was not installed. So the mail a user sent via contact form in my laravel app never got sent. Laravel never complained so I didn't even see any errors in the logs.
My question is: Did laravel or my server save the mail it tried to send anywhere so I could see what the user tried to send me?
Unless you've somehow manually added mail logging, this won't be logged for you to send later.
Laravel's Mail functionality does include a Log driver, so that mail writes to a log- but this does not work in tandem with the other drivers, so you likely have zero logs currently.
http://laravel.com/docs/5.1/mail#mail-and-local-development
There are also several results in google on how to implement global logging for all mail sent, maybe check out this or look into laravel events.

Laravel send SSH command

I'm working on a Laravel app and would need to send a SSH command to a remote server from my webapp. I know envoy can be used to this but this is not a good solution for me as envoy allows only to send a predefined command to a predefined list of servers.
In my case, I need to send a SSH command to a remote server when clicking on a button in my webapp to the IP address of a remote server that can be found on a label in the webapp.
Any suggestions?
I think it is always a good idea to stick to the language standard library if it provides the functionality you need. Please have a look at: http://php.net/manual/en/function.ssh2-exec.php

task scheduling and PHPMailer class

i am using PHPMailer class to send email its work perfect however, my application requirement is such that I have to send email every hour by using task scheduling. Thats mean I have to use PHP.exe CLI. when I tried to execute from CLI my emailsender.php; its says unable to connect SMTP host.
I'm not sure if this will help, but it might.
I had the following problem:
WAMP server. Windows computer.
I run some code and at the end send alert email (all php) using PHPMailer. If I just run the PHP file, it works fine. When I used Task Scheduler, the email doesn't work.
I think this comes from the task scheduler using a different version of PHP on my computer than that of Apache when I load the page on the server.
I got around this by using an absolute file path to the PHPMailer class. It now works fine...
Hope this helps? I'm in no way a pro at this but it worked for me!
Rich

Categories