Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once('phpmailer/PHPMailerAutoload.php');
- include('config.php');
- $mail = new PHPMailer;
- $mail->CharSet = 'utf-8';
- $mail->isSMTP();
- $mail->Host = 'smtp.mail.ru';
- $mail->SMTPAuth = true;
- $mail->Username = 'test@mail.ru';
- $mail->Password = 'pass';
- $mail->SMTPSecure = 'ssl';
- $mail->Port = 465;
- $mail->setFrom('test@mail.ru');
- $mail->addAddress('test@test'); // Кому будет уходить письмо
- $mail->isHTML(true); // Set email format to HTML
- $mail->Subject = 'Заявка с тестового сайта';
- //$result=mysqli_query($mysqli,"select * from users where id=$id");
- $mail->Body = '<table>';
- $mail->Body .= '<tr>';
- $mail->Body .= '<th>Model</th>';
- $mail->Body .= '<th>Issue</th>';
- $mail->Body .= '<th>Email</th>';
- $mail->Body .= '<th>Comment</th>';
- $mail->Body .= '<tr>';
- if (isset($_POST['send'])){
- foreach ($_POST['id'] as $id):
- $result=mysqli_query($mysqli,"select * from users where id=$id");
- while($res = mysqli_fetch_array($result)){
- $mail->Body .= '<tr>';
- $mail->Body .= '<td>' . $res["name"] . '</td>';
- $mail->Body .= '<td>' . $res["age"] . '</td>';
- $mail->Body .= '<td>' . $res["email"] . '</td>';
- $mail->Body .= "<td>" . $res["comment"] . '</td>';
- $mail->Body .= '</tr>';
- }
- $mail->Body .= '</table>';
- $mail->AltBody = '';
- if(!$mail->send()) {
- echo 'Error';
- } else {
- header('location: index.php');
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement