\n"; $headers .= "Reply-To: website name \n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n"; //Assigning the Site's base url to a variable. $mosConfig_live_site = "http://www.domainname.com"; // Assigning the section id to a array variable for which mail is sent. $list_of_sections = array("15", "18", "21"); // For each section the mail is sent. foreach($list_of_sections as $list_of_sections_temp) { echo "
Section=$list_of_sections_temp
"; if($list_of_sections_temp==15) { //for section 1 $wsx_acajoom_list=8; $wsx_mail_Itemid=241; } else if($list_of_sections_temp==18) { //for section 2 $wsx_acajoom_list=9; $wsx_mail_Itemid=242; } else { // for section 3 $wsx_acajoom_list=10; $wsx_mail_Itemid=243; } // Get the Section name for which a new content is created. $result_blog = mysql_query("SELECT `name` FROM `jos_sections` WHERE `id`=".$list_of_sections_temp); while ($row_blog = mysql_fetch_array($result_blog, MYSQL_NUM)) { // Store the Section name to a variable. $wsx_blog_name= $row_blog[0]; } // Get the id and title for the newly created content. $result = mysql_query("SELECT `id`, `title` FROM `jos_content` WHERE `trip_date`=\"new\" && `sectionid`=".$list_of_sections_temp); // For each content page the email will be sent. At present for "section 1" section there are about 750 emails. When a new page is created 750 emails will be sent for a newly created content page. while ($row = mysql_fetch_array($result, MYSQL_NUM)) { echo "

"; printf("ID: %s ", $row[0]); printf("
Content Name: %s ", $row[1]); echo "
--------- Start -----------
"; echo "

"; $subject= $wsx_blog_name." - New Article"; $title_link=$mosConfig_live_site."/index.php?option=com_content&task=view&id=".$row[0]."&Itemid=".$wsx_mail_Itemid; $title_linknew="".$row[1]."\n"; // Rephrase/arrange the message part. $messagenew=$mosConfig_email_textmail; $messagenew = str_replace("{_wsx_blog_name}",$wsx_blog_name,$messagenew); $messagenew = str_replace("{_wsx_blog_link}",$title_linknew,$messagenew); $messagenew = str_replace(""","\"",$messagenew); $message = "--$mime_boundary\n"; $message .= "Content-Type: text/html; charset=iso-8859-1\n"; $message .= "Content-Transfer-Encoding: 8bit\n\n"; $message .= "\n"; $message .= "\n"; $message .= "

".$messagenew."\n"; global $database; // Select the list of emails for which the mail has to be sent. The mailing list varies between 3 section's of content. As mentioned earlier there are about 750 emails for "section 1" section. $qry= mysql_query("SELECT `email`, `id` FROM `jos_acajoom_subscribers` WHERE `id` IN ( SELECT `subscriber_id` FROM `jos_acajoom_queue` WHERE `list_id` =".$wsx_acajoom_list." ) AND `confirmed` =1"); // Mail is sent for each email through this mail. while ($row_acajoom = mysql_fetch_array($qry, MYSQL_NUM)) { printf("
Email: %s ", $row_acajoom[0]); $message1=""; $message1.="\n\n

If you wish to unsubscribe from this list, please click here.

\n"; # -=-=-=- FINAL BOUNDARY $message1 .= "--$mime_boundary--\n\n"; # -=-=-=- SEND MAIL $message_final=$message.$message1; $mail_sent = @mail($row_acajoom[0], $subject, $message_final, $headers); echo $mail_sent ? "Mail sent" : "Mail failed"; } echo "
---------- End ----------"; // Reset the flag so that the content is no longer a newly created content. $delete_flag = mysql_query("UPDATE `jos_content` SET `trip_date` = '' WHERE `jos_content`.`id` =".$row[0]); echo "Updated content id:".$row[0]; } mysql_free_result($result); mysql_free_result($qry); echo "

"; } ?>