Advertisement
Guest User

Untitled

a guest
Dec 28th, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. <?
  2. function custom_mail($to, $subject, $message, $additional_headers, $additional_parameters){
  3. //Получаем тему письма
  4. $elements = imap_mime_header_decode($subject);
  5. $title = '';
  6. for ($i=0; $i<count($elements); $i++) {
  7. $title .= $elements[$i]->text;
  8. }
  9.  
  10. //В файле PHPMailerAutoload.php на строке 24
  11. //добавляем проверку
  12. //if( !function_exists('PHPMailerAutoload') ){}
  13.  
  14. require_once($_SERVER['DOCUMENT_ROOT'].'/cron/phpmailer/PHPMailerAutoload.php');
  15. $mail = new PHPMailer;
  16. $mail->SMTPDebug = true;
  17. $mail->isSMTP();
  18. $mail->CharSet = 'UTF-8';
  19. $mail->setLanguage('ru');
  20. // Set mailer to use SMTP
  21. $mail->Host = 'smtp.yandex.ru'; // Specify main and backup SMTP servers
  22. $mail->SMTPAuth = true; // Enable SMTP authentication
  23. $mail->Username = ''; // SMTP username
  24. $mail->Password = ''; // SMTP password
  25. $mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
  26. $mail->Port = 465;
  27.  
  28. $mail->From = 'email@from';
  29. $mail->FromName = 'Test';
  30. $mail->isHTML(true);
  31. $mail->Subject = $text;
  32. $mail->Body = $message;
  33. $mail->addAddress($to);
  34. if(!$mail->send()) {
  35. echo $mail->ErrorInfo;
  36. }
  37. $mail->clearAddresses();
  38. $mail->ClearCustomHeaders();
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement