Advertisement
anasmansouri

Untitled

Nov 16th, 2019
557
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.38 KB | None | 0 0
  1. <?php
  2.  
  3. require './email/PHPMailerAutoload.php';
  4.  
  5.  
  6. try {
  7.     $mail = new PHPMailer(true);
  8.  
  9.     // Enable verbose debug output
  10.  
  11.     $mail->isSMTP();                                 // Set mailer to use SMTP
  12.     $mail->Host = "smtp.gmail.com";
  13.     $mail->SMTPDebug = 0;
  14.     // Specify main and backup SMTP servers
  15.     $mail->SMTPAuth = true;                               // Enable SMTP authentication
  16.     $mail->Username = 'htmlphpcss3@gmail.com';                 // SMTP username
  17.     $mail->Password = 'anasgmail';                           // SMTP password
  18.     $mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
  19.     $mail->Port = 587;                                    // TCP port to connect to
  20.  
  21.     $mail->setFrom('htmlphpcss3@gmail.com', 'anas mansouri food project ');
  22.     $mail->addAddress('rizkiyounes8991@gmail.com');     // Add a recipient
  23.  
  24.     $mail->addReplyTo('htmlphpcss3@gmail.com');
  25.     // print_r($_FILES['file']); exit;
  26.     $mail->isHTML(true);                                  // Set email format to HTML
  27.  
  28.     $mail->Subject = "test ";
  29.     $mail->Body    = '<div style="border:2px solid red;">Hello world</div>';
  30.     $mail->AltBody = "msg from GSEII";
  31.  
  32.     if ($mail->send()) {
  33.         echo "message envoyer";
  34.     } else {
  35.         echo "error" . $mail->ErrorInfo;
  36.     }
  37. } catch (Exception $e) {
  38.     echo "lsd";
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement