Guest User

Untitled

a guest
Oct 24th, 2018
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. <?php
  2. $folder = scandir('Photos', 1)[0];
  3. /* Отправляем с помощью функции Mail() */
  4. mail('valalok@nyrmusic.com', 'MirrorBox - Almaty', $folder);
  5.  
  6. <?php
  7. // Import PHPMailer classes into the global namespace
  8. // These must be at the top of your script, not inside a function
  9. use PHPMailerPHPMailerPHPMailer;
  10. use PHPMailerPHPMailerException;
  11.  
  12. //Load Composer's autoloader
  13. require 'vendor/autoload.php';
  14.  
  15. $mail = new PHPMailer(true); // Passing `true` enables exceptions
  16. try {
  17. //Server settings
  18. $mail->SMTPDebug = 2; // Enable verbose debug output
  19. $mail->isSMTP(); // Set mailer to use SMTP
  20. $mail->Host = 'smtp1.example.com;smtp2.example.com'; // Specify main and backup SMTP servers
  21. $mail->SMTPAuth = true; // Enable SMTP authentication
  22. $mail->Username = 'user@example.com'; // SMTP username
  23. $mail->Password = 'secret'; // SMTP password
  24. $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
  25. $mail->Port = 587; // TCP port to connect to
  26.  
  27. //Recipients
  28. $mail->setFrom('from@example.com', 'Mailer');
  29. $mail->addAddress('joe@example.net', 'Joe User'); // Add a recipient
  30. $mail->addAddress('ellen@example.com'); // Name is optional
  31. $mail->addReplyTo('info@example.com', 'Information');
  32. $mail->addCC('cc@example.com');
  33. $mail->addBCC('bcc@example.com');
  34.  
  35. //Attachments
  36. $mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
  37. $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
  38.  
  39. //Content
  40. $mail->isHTML(true); // Set email format to HTML
  41. $mail->Subject = 'Here is the subject';
  42. $mail->Body = 'This is the HTML message body <b>in bold!</b>';
  43. $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  44.  
  45. $mail->send();
  46. echo 'Message has been sent';
  47. } catch (Exception $e) {
  48. echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
  49. }
Add Comment
Please, Sign In to add comment