Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- require_once 'phpmailer/PHPMailerAutoload.php';
- $errors=[];
- if (isset($_POST['name'], $_POST['email'], $_POST['message'])) {
- $fields = [
- 'name'=> $_POST['name'],
- 'email'=>$_POST['email'],
- 'message'=>$_POST['message']
- ];
- if(empty($errors)){
- $m = new PHPMailer();
- $m->isSMTP();
- $m->SMTPDebug =2;
- $m->SMTPAuth = true;
- $m->isHTML(true);
- $m->Host = 'smtp.gmail.com';
- $m->Username = '*********@gmail.com'; // its correct
- $m->Password ='*******'; //its correct!
- $m->SMTPSecure = 'ssl'; // I puts tls and don't works
- $m->Port = 465; // I change this also
- $mail->Debugoutput = 'html';
- $m->Subject = 'Asunto';
- $m->Body = 'De: ' .$fields['name'] . ' ('.$fields['email'].')<p>'.$fields['message'].'</p>';
- $m->FromName = 'SoyCanatlan';
- $m->addAddress('*******@gmail.com','******');// Here is my name and my email
- if($m->send()) {
- echo "Error!: ".$m->errors;
- }else {
- header('Location: thanks.php');//There is no error, send me this .php
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement