Here I am facing a problem when I send emails in the loop. Details are given below:
I have a CSV file whose name is e-mail csv. I am uploading this file and am reading email from this CSV file. I am using the Codeignit Framework. The code for reading and sending email to the CSV file, code has been 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); ($ C = 0; $ c & lt; $ num; $ c ++) for {$ this- & gt; Email-> clear (); $ This- & gt; Email-> Set_mailtype ("html"); $ This- & gt; Email-> For (trim ($ data [$ c])); $ This- & gt; Email-> From ('admin@workerbee.com '); $ This- & gt; Email-> Subject ($ data ['news_letter_info'] [0] ['subject']); $ This- & gt; Email-> Message ($ data ['news_letter_info'] [0] ['template_body']); $ This- & gt; Email-> Send (); }} Fclose ($ handle); } When I am sending emails, it takes a lot of time to execute and send email. And my browser is also hanging if there is a possible way to send these emails using the shell command which will execute PHP script in the background.
Thank you in advance
Use this.
exec ('php / & lt; server path & gt; /send_bulkmail.php'); In your send_bulkmail.php code, read the file using fread () or file_get_content () and send mail in the form as you did above < / Html>
No comments:
Post a Comment