Using phpmailer to send a message












0















I'm trying to make a registration page by sending an activation email, but I get this error using phpmailer:



Warning: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in C:xampphtdocsExercicisM08+M09phpmailerclass.smtp.php on line 269


I have already searched a lot of information but I have not found anything to solve it

My code:



<?php  
$usuario = $_POST['uname'];
$passwrod = $_POST['psw1'];
$correo = $_POST['email'];
include('phpmailer/class.phpmailer.php');
include('phpmailer/class.smtp.php');
$password = rand(1999, 9999);
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'tls';
$mail->Host = 'smtp.gmail.com';
$mail->Port = 587;
$mail->Username = 'example@gmail.com';
$mail->Password = 'secret';
$mail->From = 'example@gmail.com';
$mail->FromName = 'Administrador PHP';
$mail->Subject = 'Subject del Email';
$mail->AltBody = 'Password: "'. $password .'"';
$mail->AltBody = 'Registrat: http://localhost:3000/Practica/panell_reg.php';
$mail->MsgHTML('Registrat: http://localhost:3000/Practica/panell_reg.php<br>Password: "'. $password .'"<br>.');
$mail->AddAddress($correo);
//$mail->SMTPDebug = 4;
$mail->IsHTML(true);

if(!$mail->Send()) {
echo 'Error: ' . $mail->ErrorInfo;
} else {
echo 'Mensaje enviado correctamente';
}
?>









share|improve this question



























    0















    I'm trying to make a registration page by sending an activation email, but I get this error using phpmailer:



    Warning: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in C:xampphtdocsExercicisM08+M09phpmailerclass.smtp.php on line 269


    I have already searched a lot of information but I have not found anything to solve it

    My code:



    <?php  
    $usuario = $_POST['uname'];
    $passwrod = $_POST['psw1'];
    $correo = $_POST['email'];
    include('phpmailer/class.phpmailer.php');
    include('phpmailer/class.smtp.php');
    $password = rand(1999, 9999);
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->SMTPAuth = true;
    $mail->SMTPSecure = 'tls';
    $mail->Host = 'smtp.gmail.com';
    $mail->Port = 587;
    $mail->Username = 'example@gmail.com';
    $mail->Password = 'secret';
    $mail->From = 'example@gmail.com';
    $mail->FromName = 'Administrador PHP';
    $mail->Subject = 'Subject del Email';
    $mail->AltBody = 'Password: "'. $password .'"';
    $mail->AltBody = 'Registrat: http://localhost:3000/Practica/panell_reg.php';
    $mail->MsgHTML('Registrat: http://localhost:3000/Practica/panell_reg.php<br>Password: "'. $password .'"<br>.');
    $mail->AddAddress($correo);
    //$mail->SMTPDebug = 4;
    $mail->IsHTML(true);

    if(!$mail->Send()) {
    echo 'Error: ' . $mail->ErrorInfo;
    } else {
    echo 'Mensaje enviado correctamente';
    }
    ?>









    share|improve this question

























      0












      0








      0








      I'm trying to make a registration page by sending an activation email, but I get this error using phpmailer:



      Warning: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in C:xampphtdocsExercicisM08+M09phpmailerclass.smtp.php on line 269


      I have already searched a lot of information but I have not found anything to solve it

      My code:



      <?php  
      $usuario = $_POST['uname'];
      $passwrod = $_POST['psw1'];
      $correo = $_POST['email'];
      include('phpmailer/class.phpmailer.php');
      include('phpmailer/class.smtp.php');
      $password = rand(1999, 9999);
      $mail = new PHPMailer();
      $mail->IsSMTP();
      $mail->SMTPAuth = true;
      $mail->SMTPSecure = 'tls';
      $mail->Host = 'smtp.gmail.com';
      $mail->Port = 587;
      $mail->Username = 'example@gmail.com';
      $mail->Password = 'secret';
      $mail->From = 'example@gmail.com';
      $mail->FromName = 'Administrador PHP';
      $mail->Subject = 'Subject del Email';
      $mail->AltBody = 'Password: "'. $password .'"';
      $mail->AltBody = 'Registrat: http://localhost:3000/Practica/panell_reg.php';
      $mail->MsgHTML('Registrat: http://localhost:3000/Practica/panell_reg.php<br>Password: "'. $password .'"<br>.');
      $mail->AddAddress($correo);
      //$mail->SMTPDebug = 4;
      $mail->IsHTML(true);

      if(!$mail->Send()) {
      echo 'Error: ' . $mail->ErrorInfo;
      } else {
      echo 'Mensaje enviado correctamente';
      }
      ?>









      share|improve this question














      I'm trying to make a registration page by sending an activation email, but I get this error using phpmailer:



      Warning: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in C:xampphtdocsExercicisM08+M09phpmailerclass.smtp.php on line 269


      I have already searched a lot of information but I have not found anything to solve it

      My code:



      <?php  
      $usuario = $_POST['uname'];
      $passwrod = $_POST['psw1'];
      $correo = $_POST['email'];
      include('phpmailer/class.phpmailer.php');
      include('phpmailer/class.smtp.php');
      $password = rand(1999, 9999);
      $mail = new PHPMailer();
      $mail->IsSMTP();
      $mail->SMTPAuth = true;
      $mail->SMTPSecure = 'tls';
      $mail->Host = 'smtp.gmail.com';
      $mail->Port = 587;
      $mail->Username = 'example@gmail.com';
      $mail->Password = 'secret';
      $mail->From = 'example@gmail.com';
      $mail->FromName = 'Administrador PHP';
      $mail->Subject = 'Subject del Email';
      $mail->AltBody = 'Password: "'. $password .'"';
      $mail->AltBody = 'Registrat: http://localhost:3000/Practica/panell_reg.php';
      $mail->MsgHTML('Registrat: http://localhost:3000/Practica/panell_reg.php<br>Password: "'. $password .'"<br>.');
      $mail->AddAddress($correo);
      //$mail->SMTPDebug = 4;
      $mail->IsHTML(true);

      if(!$mail->Send()) {
      echo 'Error: ' . $mail->ErrorInfo;
      } else {
      echo 'Mensaje enviado correctamente';
      }
      ?>






      php html email phpmailer






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 11 '18 at 17:14









      OriolOriol

      276




      276
























          1 Answer
          1






          active

          oldest

          votes


















          2














          PHP 5.6 verifies SSL certificates by default, and if there is a problem relating to certificate you will get this error. The correct solution is to fix your SSL config. You can read about this error in the toubleshooting docs for PHPMailer https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting?






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f49222803%2fusing-phpmailer-to-send-a-message%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            PHP 5.6 verifies SSL certificates by default, and if there is a problem relating to certificate you will get this error. The correct solution is to fix your SSL config. You can read about this error in the toubleshooting docs for PHPMailer https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting?






            share|improve this answer




























              2














              PHP 5.6 verifies SSL certificates by default, and if there is a problem relating to certificate you will get this error. The correct solution is to fix your SSL config. You can read about this error in the toubleshooting docs for PHPMailer https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting?






              share|improve this answer


























                2












                2








                2







                PHP 5.6 verifies SSL certificates by default, and if there is a problem relating to certificate you will get this error. The correct solution is to fix your SSL config. You can read about this error in the toubleshooting docs for PHPMailer https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting?






                share|improve this answer













                PHP 5.6 verifies SSL certificates by default, and if there is a problem relating to certificate you will get this error. The correct solution is to fix your SSL config. You can read about this error in the toubleshooting docs for PHPMailer https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting?







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 11 '18 at 18:54









                Offorma ChideraOfforma Chidera

                215




                215
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f49222803%2fusing-phpmailer-to-send-a-message%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Costa Masnaga

                    Fotorealismo

                    Sidney Franklin