Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- date_default_timezone_set('Europe/Moscow');
- require 'phpMailer/PHPMailerAutoload.php';
- $mail = new PHPMailer;
- $mail->IsSMTP();
- $mail->Host = 'smtp.gmail.com';
- $mail->SMTPAuth = true;
- $mail->SMTPSecure = 'ssl';
- $mail->Port = 465;
- $mail->CharSet = 'UTF-8';
- $body = file_get_contents('content.html');
- $mail->Username = 'xxxxxx@gmail.com';
- $mail->Password = 'xxxxxx';
- $mail->SetFrom('xxxxx@gmail.com', 'xxx');
- $mail->Subject = 'Отправка письма с GMAIL';
- $mail->MsgHTML($body);
- $address = 'xxxxx@gmail.com';
- $mail->AddAddress($address,'to_xxxx');
- if($mail->Send()){
- echo 'Письмо отправлено';
- }else{
- echo $mail->ErrorInfo;
- }
- ?>
- SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement