

How to send a large number of emails using the php and shell command
source link: https://www.codesd.com/item/how-to-send-a-large-number-of-emails-using-the-php-and-shell-command.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

How to send a large number of emails using the php and shell command
Here I am facing a problem when I am send email in loop. The Details is given below:
I have a csv file called email.csv. I am uploading this file and read the email from this csv file.I am using codeignitor framework. The code for reading the csv file and send the emails, the code is given as follows.
$file = $_FILES['email_from_file'][tmp_name];
$handle = fopen($file,"r");
if (($handle = fopen($file,"r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$num = count($data);
for ($c=0; $c < $num; $c++) {
$this->email->clear();
$this->email->set_mailtype("html");
$this->email->to(trim($data[$c]));
$this->email->from('[email protected]');
$this->email->subject($data['news_letter_info'][0]['subject']);
$this->email->message($data['news_letter_info'][0]['template_body']);
$this->email->send();
}
}
fclose($handle);
}
when I am sending the email its take too much time to execute and sending the email. And my browser also became hang. So is there have any possible way to send these emails using shell command which will execute the php script in the background.
Thank in advance.
Use this.
exec('php /<SERVER PATH>/send_bulkmail.php');
In your send_bulkmail.php use code to read file using fread() or file_get_content() and send mail in lood as you have done above.
Recommend
-
16
Using Amazon SES and S3 to Send Emails with AttachmentsAugust 19th 2021 new story5
-
6
Send Emails using the SendGrid API with .NET 6 and C#
-
7
Not FoundYou just hit a route that doesn't exist... the sadness.LoginRadius empowers businesses to deliver a delightful customer experience and win customer trust. Using the LoginRadius Identity...
-
7
[Bash] Move Large Number of Files via tar Command April 29, 2016
-
11
by Sajal SoniJun 11, 2018Read Time:6 minsLanguages: In this article, we're going to explore the Swift Mailer library, wh...
-
6
Francis T. O'Donovan Senior Data Science Manager at Hospital IQ – Planet discoverer, researcher, dev...
-
5
Send Recurring Emails using C# .NET and Hangfire with SendGrid
-
7
-
8
Send Emails Using Different Lead Recipient Fields In Journeys 2023-08-23 Categories: Dynamics Marketing
-
5
Extract Emails From a Text File Using Grep Command in Linux ...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK