Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $data = date("d-m-Y H:i:s");
- include('database_connection.php');
- include('function.php');
- require 'class/class.phpmailer.php';
- $output = '';
- $output1 = '';
- $count_prodotti = 0;
- $query = "
- SELECT * FROM product
- ";
- $statement = $connect->prepare($query);
- $statement->execute(
- array(
- )
- );
- $result = $statement->fetchAll();
- foreach($result as $row)
- {
- if($row['product_quantity'] <= $row['prodotto_minimo'])
- {
- $count_prodotti = $count_prodotti + 1;
- $output .= '
- <strong>'.$row['product_id'].' '.get_category_nome($connect, $row['category_id']).' - '.get_brand_nome($connect, $row['brand_id']).' - '.get_modello_nome($connect, $row['id_modello']).'</strong><div>'.$row["product_name"].': <strong><font color="red">'.$row["product_quantity"].'</font></strong> Pz</div><span class="date"><em>Prodotto</em>
- ';
- }
- }
- $mail = new PHPMailer;
- $mail->IsSMTP(); //Sets Mailer to send message using SMTP
- $mail->Host = 'smtp.gmail.com'; //Sets the SMTP hosts of your Email hosting, this for Godaddy
- $mail->Port = '465'; //Sets the default SMTP server port
- $mail->SMTPAuth = true; //Sets SMTP authentication. Utilizes the Username and Password variables
- $mail->SMTPDebug = 0; // debug: 1 = solo messaggi, 2 = errori e messaggi
- $mail->Username = 'EMAIL@gmail.com'; //Sets SMTP username
- $mail->Password = 'PASSWORD'; //Sets SMTP password
- $mail->SMTPSecure = 'ssl'; //Sets connection prefix. Options are "", "ssl" or "tls"
- $mail->From = 'mittente@gmail.com'; //Sets the From email address for the message
- $mail->FromName = 'Nome'; //Sets the From name of the message
- $mail->AddAddress('destinatario@gmail.com','TIA'); //Adds a "To" address
- $mail->WordWrap = 50; //Sets word wrapping on the body of the message to a given number of characters
- $mail->IsHTML(true); //Sets message type to HTML
- $mail->Subject = 'Alert Prodotti '.$data; //Sets the Subject of the message
- //An HTML or plain text message body
- $mail->Body = 'Totale Prodotti da ordinare: '.$count_prodotti.'<br>'.$output;
- $mail->AltBody = 'Body';
- //$pdfString = $pdf->output();
- //$mail->addStringAttachment($pdfString, $file_name);
- $result = $mail->Send(); //Send an Email. Return true on success or false on error
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement