Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static function send($email,$subject,$message){
- $mail = new PHPMailer();
- $mail->isSMTP();
- $mail->SMTPDebug = 2;
- $mail->Host = 'smtp.yandex.ru';
- $mail->SMTPAuth = true;
- $mail->ChartSet='UTF-8';
- $mail->Username = 'mihail.donatelo@yandex.ua'; // SMTP username
- $mail->Password = 'mihail.donatelo228'; // SMTP password
- $mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
- $mail->Port = 465;
- $mail->setFrom('mihail.donatelo@yandex.ua','rwqrqwrwq');
- if(is_array($email)&& !empty($email)){
- foreach($email as $item){
- $mail->addAddress($item);
- }
- }else{
- $mail->addAddress($email);
- }
- $mail->Subject = $subject;
- $mail->Body = $message;
- if(!$mail->send()) {
- echo 'Message could not be sent.';
- echo 'Mailer Error: ' . $mail->ErrorInfo;
- } else {
- echo 'Message has been sent';
- }
- exit;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement