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.
192 lines
6.9 KiB
192 lines
6.9 KiB
<?php
|
|
@include '../cgi-bin/params.inc';
|
|
|
|
function sendMail($SM_email, $SM_email2, $SM_email_CC, $SM_subject, $SM_message, $SM_showalert, $SM_append) {
|
|
|
|
$host = "https://".$_SERVER['HTTP_HOST']."";
|
|
$send_date = date("Y-m-d");//conv_date(date("Y-m-d"));
|
|
$message = "";
|
|
|
|
$top="<html><head><style>
|
|
body{font-family: sans, Arial; margin: 0px; font-size: 10pt;}
|
|
td{font-family: sans-serif; font-size: 10pt;}
|
|
</style><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></head><body style=\"background-color: #4e984a\"><center>
|
|
<table border=\"0\" style=\"width: 90%; min-width:300px\" cellspadding=\"20\">
|
|
<tr><td align=\"center\" colspan=\"2\">
|
|
<br><br><img src=\"$host/images/header.png\" alt=\"Ordine dei Farmacisti di Salerno\" width=\"400\"><br></td></tr>
|
|
<tr><td align=\"left\" style=\"padding:5px; color: white\" ><b>$SM_subject</b></td>
|
|
<td align=\"right\" style=\"padding:5px; color: white\" >$send_date</td></tr>
|
|
<tr><td style=\"border-top: 8px solid #FFFFFF;border-left: 1px solid #FFFFFF;border-right: 1px solid #FFFFFF;border-bottom: 8px solid #FFFFFF;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px; padding:30px;line-height:23px;background-color: white\" colspan=\"2\">";
|
|
|
|
|
|
$bottom="</td></tr><tr><td colspan=\"2\" align=\"center\" style=\"text-align:justify; font-size:8pt; color: white\"><br>".
|
|
"Questa e-mail contiene informazioni di proprietà e di natura confidenziale. Se non siete il destinatario corretto di questo messaggio, vi ricordiamo che ogni diffusione, distribuzione o copia di questo messaggio è severamente proibita. Se avete ricevuto questo messaggio per errore, siete pregati di cancellarlo immediatamente. Quanto precede ai fini del rispetto del D.L. n. 196/03 sulla tutela dei dati personali.<br>-<br>".
|
|
"This e-mail (and any attachments) is strictly confidential and for use only by intendend recipients. If you are not an intended recipients, we point you that any diffusion, distribution or copy of this message is severely forbidden. If you have received t his message by mistake please destroy it immediately (under the observance of D.L. n. 196/03 which protects personal data).".
|
|
"<br>Rispetta l'ambiente. Non stampare questa mail se non è necessaria.<br><br></td></tr></table></center></body></html>";
|
|
|
|
|
|
$headers = "From: \"Ordine Farmacisti Salerno\" <info@ordinefarmacistisalerno.it>\r\n";
|
|
$headers .= "Reply-To: \"Ordine Farmacisti Salerno\" <info@ordinefarmacistisalerno.it>\r\n";
|
|
|
|
if($SM_email_CC) { $headers .= "CC: $SM_email_CC\r\n"; }
|
|
|
|
$headers .= "MIME-Version: 1.0\r\n";
|
|
|
|
if($SM_append){
|
|
|
|
$append_name = basename($SM_append);
|
|
$append_type = mime_content_type($SM_append);
|
|
|
|
$data = chunk_split(base64_encode(file_get_contents($SM_append)));
|
|
|
|
$semi_rand = md5(time());
|
|
$mime_boundary = md5(uniqid(time()));//"==Multipart_Boundary_x{$semi_rand}x";
|
|
|
|
$headers .= "Content-Type: multipart/mixed; boundary=\"$mime_boundary\"\r\n";
|
|
$headers .= "X-Mailer: PHP " . phpversion()."\r\n";
|
|
|
|
$message .= "This is a multi-part message in MIME format.\r\n";
|
|
$message .= "--$mime_boundary\r\n";
|
|
$message .= "Content-Type: text/html; charset=\"utf-8\"\r\n";
|
|
$message .= "Content-Transfer-Encoding: 7bit\r\n";
|
|
$message .= $top.$SM_message.$bottom."\r\n";
|
|
$message .= "--$mime_boundary\r\n";
|
|
$message .= "Content-Type: {$append_type}; name=\"{$append_name}\"\r\n";
|
|
$message .= "Content-Transfer-Encoding: base64\r\n";
|
|
$message .= "Content-Disposition: attachment; filename=\"{$append_name}\"\r\n";
|
|
$message .= $data."\r\n\r\n";
|
|
$message .= "--$mime_boundary--";
|
|
|
|
} else {
|
|
$headers .= "Content-Type: text/html; charset=\"utf-8\"\r\n";
|
|
$message = $top.$SM_message.$bottom;
|
|
}
|
|
|
|
|
|
$success = mail($SM_email, $SM_subject, $message, $headers);
|
|
if(!$success) {
|
|
$errorMessage = error_get_last()['message'];
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($_POST['title']) {
|
|
|
|
$SM_email = $_POST['dest'];
|
|
$SM_email2 = $_POST['dest'];
|
|
$SM_email_CC = $_POST['dest'];
|
|
$SM_subject = $_POST['title'];
|
|
$SM_message = $_POST['text'];
|
|
$SM_showalert = 0;
|
|
$SM_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");
|
|
$SM_append = "$path/$filename";
|
|
}
|
|
|
|
|
|
|
|
sendMail($SM_email, $SM_email2, $SM_email_CC, $SM_subject, $SM_message, $SM_showalert, $SM_append);
|
|
|
|
echo "Mail inviata";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>TEST EMAIL</title>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
|
|
<base href="<?php echo $BASE_URL;?>/">
|
|
<link href="<?php echo $BASE_URL;?>/css/styles.css" rel="stylesheet" type="text/css"/>
|
|
<link href="<?php echo $BASE_URL;?>/css/admin.css" rel="stylesheet" type="text/css"/>
|
|
<link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
|
|
|
|
</head>
|
|
<body class="admin">
|
|
|
|
|
|
<form method="post" enctype="multipart/form-data">
|
|
<div class="row px-6 mx-auto">
|
|
<div class="col-12">
|
|
<span class="font-12">Destinatario</span>
|
|
<input type="text" name="dest">
|
|
</div>
|
|
<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 text-right">
|
|
<button type="submit" name="go" value="1">Invia</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
|
|
<script type="text/javascript" src="<?php echo $BASE_URL;?>/node_modules/jquery/dist/jquery.min.js"></script>
|
|
<script type="text/javascript" src="<?php echo $BASE_URL;?>/node_modules/tinymce/tinymce.min.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready( function(){
|
|
tinymce.init({
|
|
selector: '.mce',
|
|
height: 300,
|
|
theme: 'modern',
|
|
menubar: false,
|
|
language: 'it',
|
|
forced_root_block : '',
|
|
force_br_newlines : true,
|
|
relative_urls : false,
|
|
remove_script_host : false,
|
|
plugins: [
|
|
'advlist autolink lists link paste'
|
|
],
|
|
toolbar: 'bold italic underline | alignleft aligncenter alignright alignjustify | link bullist numlist| removeformat',
|
|
image_advtab: false,
|
|
content_css: [
|
|
'//fonts.googleapis.com/css?family=Lato:300,300i,400,400i',
|
|
]
|
|
});
|
|
});
|
|
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|