Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // The FILTER_SANITIZE_STRING filter removes tags and remove or encode special characters from a string.
- $n = filter_var($_POST['CN'], FILTER_SANITIZE_STRING);
- $e = filter_var($_POST['CE'], FILTER_SANITIZE_STRING);
- require 'libs/PHPMailer/PHPMailerAutoload.php';
- $mail = new PHPMailer;
- $mail->SMTPDebug = 0;
- $mail->setFrom('***', 'Test1');
- $mail->addAddress('***', 'Test2');
- $mail->Subject = 'Request';
- if (isset($_FILES['fileIMG']['name'])) {
- $mail->AddAttachment($_FILES['fileIMG']['tmp_name'],
- $_FILES['fileIMG']['name']);
- }
- if (isset($_FILES['fileEAN']['name'])) {
- $mail->AddAttachment($_FILES['fileEAN']['tmp_name'],
- $_FILES['fileEAN']['name']);
- }
- $body = file_get_contents('mail_template.html');
- $body = str_replace('%CN%', $n, $body);
- $body = str_replace('%CE%', $e, $body);
- $mail->MsgHTML($body);
- $mail->IsHTML(true);
- $mail->CharSet="utf-8";
- $mail->isSMTP();
- $mail->Host = '***';
- // optional
- // used only when SMTP requires authentication
- $mail->Port = 25;
- $mail->SMTPAuth = true;
- $mail->Username = '***';
- $mail->Password = '***';
- if(!$mail->send()) {
- echo 'Error';
- } else {
- echo 'Success';
- }
- ?>
Add Comment
Please, Sign In to add comment