You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							257 lines
						
					
					
						
							11 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							257 lines
						
					
					
						
							11 KiB
						
					
					
				| <div class="row"> | |
|     <div class="col-12"> | |
|         <div class="section-title">Invia E-mail</div> | |
|     </div> | |
|     <div class="col-12"> | |
| 
 | |
|         <div class="sheet-box p-4"> | |
| 
 | |
|         <?php | |
| 
 | |
|         if($_POST['go']) { | |
| 
 | |
|             $_SESSION['maillist']=array(); | |
|             $_SESSION['subject']=$_POST['title']; | |
|             $_SESSION['message_text']=convert_mce($_POST['text']); | |
|             $_SESSION['append']=0; | |
| 
 | |
|             if(is_uploaded_file($_FILES['append']['tmp_name'])){ | |
|                 $filename = date("Ymd")."-".preg_replace('/[^a-zA-Z0-9\-\._]/','_', $_FILES['append']['name']); | |
|                 $path = '../docs/files/email'; | |
|                 move_uploaded_file($_FILES['append']['tmp_name'], "$path/$filename"); | |
|                 $_SESSION['append'] = "$path/$filename"; | |
|             } | |
| 
 | |
|             if(@$_POST['board']){ | |
|                 $q=mysqli_query($conn, "SELECT email, last_name, first_name FROM board WHERE email!='' AND newsletter=1"); | |
|                 while($res=mysqli_fetch_array($q)){ | |
|                     $_SESSION['maillist'][]=$res['email']; | |
|                 } | |
|                 $_SESSION['maillist'][]="dslaky@gmail.com"; | |
|             } | |
| 
 | |
|             if(@$_POST['board_no_nl']){ | |
|                 $q=mysqli_query($conn, "SELECT email, last_name, first_name FROM board WHERE email!='' AND newsletter=0"); | |
|                 while($res=mysqli_fetch_array($q)){ | |
|                     $_SESSION['maillist'][]=$res['email']; | |
|                 } | |
|                 $_SESSION['maillist'][]="dslaky@gmail.com"; | |
|             } | |
| 
 | |
|             if(@$_POST['board_salerno']){ | |
|             $q=mysqli_query($conn, "SELECT email, last_name, first_name FROM board WHERE city LIKE '%salerno%' AND  email!='' AND newsletter=1"); | |
|                 while($res=mysqli_fetch_array($q)){ | |
|                     $_SESSION['maillist'][]=$res['email']; | |
|                 } | |
|                 $_SESSION['maillist'][]="dslaky@gmail.com"; | |
|             } | |
| 
 | |
|             if(@$_POST['board_salerno_no_nl']){ | |
|             $q=mysqli_query($conn, "SELECT email, last_name, first_name FROM board WHERE city LIKE '%salerno%' AND  email!='' AND newsletter=0"); | |
|                 while($res=mysqli_fetch_array($q)){ | |
|                     $_SESSION['maillist'][]=$res['email']; | |
|                 } | |
|                 $_SESSION['maillist'][]="dslaky@gmail.com"; | |
|             } | |
| 
 | |
|             if(@$_POST['salerno']){ | |
|             $q=mysqli_query($conn, "SELECT pharmacy, email FROM pharmacy WHERE pharmacy!='COMUNALE' AND city='SALERNO'"); | |
|                 while($res=mysqli_fetch_array($q)){ | |
|                     $_SESSION['maillist'][]=$res['email']; | |
|                 } | |
|                 $_SESSION['maillist'][]="dslaky@gmail.com"; | |
|             } | |
| 
 | |
|             if(@$_POST['province']){ | |
|             $q=mysqli_query($conn, "SELECT pharmacy, email FROM pharmacy WHERE pharmacy!='COMUNALE' AND city!='SALERNO'"); | |
|                 while($res=mysqli_fetch_array($q)){ | |
|                     $_SESSION['maillist'][]=$res['email']; | |
|                 } | |
|                 $_SESSION['maillist'][]="dslaky@gmail.com"; | |
|             } | |
| 
 | |
|             if(@$_POST['municipal']){ | |
|             $q=mysqli_query($conn, "SELECT pharmacy, email FROM pharmacy WHERE pharmacy='COMUNALE' AND city!='SALERNO'"); | |
|                 while($res=mysqli_fetch_array($q)){ | |
|                     $_SESSION['maillist'][]=$res['email']; | |
|                 } | |
|                 $_SESSION['maillist'][]="dslaky@gmail.com"; | |
|             } | |
| 
 | |
|             if(@$_POST['rural']){ | |
|             $q=mysqli_query($conn, "SELECT pharmacy, email FROM pharmacy WHERE type='Rurale'"); | |
|                 while($res=mysqli_fetch_array($q)){ | |
|                     $_SESSION['maillist'][]=$res['email']; | |
|                 } | |
|                 $_SESSION['maillist'][]="dslaky@gmail.com"; | |
|             } | |
| 
 | |
|             if(@$_POST['urban']){ | |
|             $q=mysqli_query($conn, "SELECT pharmacy, email FROM pharmacy WHERE type='Urbana'"); | |
|                 while($res=mysqli_fetch_array($q)){ | |
|                     $_SESSION['maillist'][]=$res['email']; | |
|                 } | |
|                 $_SESSION['maillist'][]="dslaky@gmail.com"; | |
|             } | |
| 
 | |
|             if(@$_POST['parapharmacy']){ | |
|             $q=mysqli_query($conn, "SELECT parapharmacy, email FROM parapharmacy"); | |
|                 while($res=mysqli_fetch_array($q)){ | |
|                     $_SESSION['maillist'][]=$res['email']; | |
|                 } | |
|                 $_SESSION['maillist'][]="dslaky@gmail.com"; | |
|             } | |
| 
 | |
|             if(@$_POST['other']){ | |
|                 $allmail=explode("\n",$_POST['other_dest']); | |
|                 for($i=0;$i<count($allmail);$i++){ | |
|                     $_SESSION['maillist'][]=trim($allmail[$i]); | |
|                 } | |
|                 $_SESSION['maillist'][]="dslaky@gmail.com"; | |
|             } | |
|         } | |
| 
 | |
| 
 | |
| 
 | |
|         $mailcount=count($_SESSION['maillist']); | |
| 
 | |
|         // 200 mail 20 min | |
|  | |
|         if($mailcount){ | |
| 
 | |
|             if($mailcount>200){ | |
|                 echo "<br><br><br><center><br><h2>INVIO IN CORSO</h2><br>Non chiudere o ricaricare la pagina.<br><br>"; | |
|                 echo "<b>".$mailcount."</b> mail alla conclusione.<br><br>"; | |
|                 echo "<img src=\"$BASE_URL/../images/loading_spinner.gif\"></center>"; | |
|             } | |
| 
 | |
| 
 | |
|             $mailsend = array_slice($_SESSION['maillist'],0,200); | |
| 
 | |
|             $SM_email = "dslaky@gmail.com"; | |
|             $SM_email2 = 0; | |
|             $SM_email_CC = 0; | |
|             $SM_subject = $_SESSION['subject']; | |
|             $SM_message = $_SESSION['message_text']; | |
|             $SM_showalert = 0; | |
|             $SM_append = $_SESSION['append']; | |
| 
 | |
|             foreach($mailsend as $email){ | |
|                 if(trim($email) != '') { | |
|                     $SM_email = $email; | |
| 
 | |
|                     $mailFooter = "<table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" style=\"border-top: 1px solid gray\">". | |
|                                   "<tr><td colspan=\"2\" align=\"center\" style=\"text-align:justify; font-size:6pt; color: gray\">". | |
|                                   "Ricevi questa mail perchè sei iscritto alla newsletter dell'Ordine dei Farmacisti della Provincia di Salerno, se ti sei iscritto per sbaglio o se desideri non ricevere più email come questa accedi al tuo account ed annulla l'iscrizione, oppure <a href=\"$BASE_URL/../unsubscribe/$SM_email\">clicca qui</a></td></tr></table>"; | |
|                     sendMail($SM_email,$SM_email2,$SM_email_CC,$SM_subject,$SM_message,$SM_showalert,$SM_append); | |
|                     //echo $SM_email."<br>";.'<br><br>'.$mailFooter | |
|                 } | |
|             } | |
|  | |
|             //sendMail("dslaky@gmail.com",$SM_email2,$SM_email_CC,$SM_subject." (-".(round($mailcount/200)).")",$SM_message,$SM_showalert,$SM_append); | |
|  | |
|             array_splice($_SESSION['maillist'],0,200); | |
|  | |
|             if($mailcount<=200){ | |
|                 echo '<div class="col-10 text-center mx-auto my-5"> | |
|                         <p><i class="fa fa-check-circle font-alert p-4"></i></p> | |
|                         E-mail inviate correttamente! | |
|                     </div>'; | |
|             }else{ | |
|                 echo "<script>setTimeout('window.location=\"$BASE_URL/sheets/email/send\"',120000);</script>"; | |
|             } | |
|  | |
|         } else { | |
|  | |
|  | |
|         ?> | |
|             <form method="post" enctype="multipart/form-data"> | |
|                 <div class="row"> | |
|                     <div class="col-12"> | |
|                         <span class="font-12">Oggetto</span> | |
|                         <input type="text" name="title"> | |
|                     </div> | |
|                     <div class="col-12 pb-2"> | |
|                         <span class="font-12">Testo</span> | |
|                         <textarea cols="40" rows="6" name="text" class="mce"></textarea> | |
|                     </div> | |
|  | |
|                     <div class="col-12"> | |
|                         <span class="font-12">Allegato</span> | |
|                         <input type="file" name="append"> | |
|                     </div> | |
|  | |
|                     <div class="col-12 row mt-3"> | |
|                         <div class="col-12"> | |
|                             <span class="font-12">Destinatari</span> | |
|                         </div> | |
|                         <div class="col-12"> | |
|                             <input type="checkbox" name="board" id="board"> | |
|                             <label for="board">Iscritti all'albo (che hanno acconsentito all'invio di newsletter)</label> | |
|                         </div> | |
|                         <div class="col-12"> | |
|                             <input type="checkbox" name="board_no_nl" id="board_no_nl"> | |
|                             <label for="board_no_nl">Iscritti all'albo (che hanno NON acconsentito all'invio di newsletter)</label> | |
|                         </div> | |
|  | |
|                         <div class="col-12"> | |
|                             <input type="checkbox" name="board_salerno" id="board_salerno"> | |
|                             <label for="board_salerno">Iscritti all'albo residenti a Salerno città (che hanno acconsentito all'invio di newsletter)</label> | |
|                         </div> | |
|                         <div class="col-12"> | |
|                             <input type="checkbox" name="board_salerno_no_nl" id="board_salerno_no_nl"> | |
|                             <label for="board_salerno_no_nl">Iscritti all'albo residenti a Salerno città (che NON hanno acconsentito all'invio di newsletter)</label> | |
|                         </div> | |
|  | |
|                         <div class="col-6"> | |
|                             <input type="checkbox" name="salerno" id="salerno"> | |
|                             <label for="salerno">Farmacie di Salerno città</label> | |
|                         </div> | |
|  | |
|                         <div class="col-6"> | |
|                             <input type="checkbox" name="province" id="province"> | |
|                             <label for="province">Farmacie della Provincia (esclusa Salerno città)</label> | |
|                         </div> | |
|  | |
|                         <div class="col-6"> | |
|                             <input type="checkbox" name="parapharmacy" id="parapharmacy"> | |
|                             <label for="parapharmacy">Parafarmacie</label> | |
|                         </div> | |
|  | |
|                         <div class="col-6"> | |
|                             <input type="checkbox" name="municipal" id="municipal"> | |
|                             <label for="municipal">Farmacie Comunali (esclusa Salerno città)</label> | |
|                         </div> | |
|  | |
|                         <div class="col-6"> | |
|                             <input type="checkbox" name="rural" id="rural"> | |
|                             <label for="rural">Farmacie Rurali (tutte)</label> | |
|                         </div> | |
|  | |
|                         <div class="col-6"> | |
|                             <input type="checkbox" name="urban" id="urban"> | |
|                             <label for="urban">Farmacie Urbane (tutte)</label> | |
|                         </div> | |
|  | |
|                         <div class="col-12 pr-0"> | |
|                             <input type="checkbox" name="other" id="other"> | |
|                             <label for="other">Altri destinatari - Indirizzi E-Mail (uno sotto l'altro)</label> | |
|                             <textarea name="other_dest" cols="40" rows="3" style="width: 100%"></textarea> | |
|                         </div> | |
|  | |
|                     </div> | |
|  | |
|                     <div class="col-12 text-right"> | |
|                         <button type="submit" name="go" value="1">Invia</button> | |
|                     </div> | |
|                 </div> | |
|             </form> | |
|         <?php | |
|         } | |
|         ?> | |
|  | |
|         </div> | |
|  | |
|     </div> | |
| </div> | |
| 
 |