Jump to content
Larry Ullman's Book Forums

Jai

Members
  • Posts

    21
  • Joined

  • Last visited

Posts posted by Jai

  1. I have studied php introduction and php advanced object oriented programming, Was able to get my hands on small projects such as building small websites, Buiding forums. I will like to know which project book is the best php project book guide to guide developers on building dynamic applications(such as social media platforms, educational platform, online libraries...etc) using php. Which is the best with detail and straight forward explanation.

  2.  I figured out.. that to use phpmailer, the class had to be defined first(i.e. immediately after the opening php tag) before any line of code.

    The mistake i did when trying to use it before was; i included the class only within the body of my script when the code for the message section was written which then threw the exception (UNCAUGHT ERROR ;PHPMAILER CLASS NOT FOUND). So in order to use the phpmailer to send email from a particular script, I did as this:

    <?php

    //define the phpmailer class

    use PHPMAILER\PHPMAILER\PHPMAILER;

    use PHPMAILER\PHPMAILER\Exception;

    /*

    here comes the code for the script,

    for instance including a script, validating the form, checking if the form has been submitted,

    submitting and whatever..

    */

    /*

    After wriiting all the codes above, the section of code which should

    send the mail  is the phpmailer body with my credentials for authentication.

    */

      require 'absolute path to the autoload.php file';
     
                    $mail = new PHPMailer(TRUE);
     
                    try {
       
                        $mail->setFrom('email@example.com''optional');
     
                        $mail->addAddress($trimmed['email'], $trimmed['first_name']);
     
                        $mail->Subject = 'Subject';
     
                        $mail->Body = $body(comes from the lines of codes written above before this section of codes);
                        
                        /* SMTP parameters. */
                        
                        /* Tells PHPMailer to use SMTP. */
                        $mail->isSMTP();
                        
                        /* SMTP server address. */
                        $mail->Host = 'smtp.gmail.com';
                     
                        /* Use SMTP authentication. */
                        $mail->SMTPAuth = TRUE;
                        
                        /* Set the encryption system. */
                        $mail->SMTPSecure = 'tls';
                        
                        /* SMTP authentication username. */
                        $mail->Username = 'email address to be use to send the mail to other email addresses';
                        
                        /* SMTP authentication password. */
                        $mail->Password = 'password of email address used to send the mail to other email addresses';
                        
                        /* Set the SMTP port. */
                        $mail->Port = 587;
                        
                        /* Finally send the mail. */
                        $mail->send();
                       
                     }
                     catch (Exception $e)
                     {
                        echo $e->errorMessage();
                     }
                     catch (\Exception $e)
                     {
                        echo $e->getMessage();
                     }
     
                    // finish the page
                    echo '<h3>A message to confirm that the mail was sent.</h3>';
     
                    include('includes/footer.html');
                    exit();
     
     
    NOTE: I HAD TO TURN ON LESS SECURE APPS PERMISSION FOR THE GMAIL ACCOUNT WHICH IS USED TO SEND EMAILS TO OTHER EMAIL ADDRESSES. NOT TURNING ON LESS SECURE APPS FOR THE RECIPIENTS ACCOUNT
  3. Hello, i have been studying this book "php 6 and mysql 5 for dynamic website" on my own... i am happy i finished studying this book and this gave me an advanced basic understanding in PHP and MYSQL. Please i will like some recommendations on which php and mysql book to study/buy next in order to have more advanced knowledge in php and mysql.

    So as to be able to create a section in my web application to read pdf files. And also to be able to create an e-commerce application.

     

    Thank you, 

    Jai.

  4. Hi Necuima! i have been able to do the installation of phpmailer and put my credentials successfully, but when i run the script on my browser, i have this resulting

    Quote

    2020-04-04 09:48:32 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP w16sm7501538pfj.79 - gsmtp
    2020-04-04 09:48:32 CLIENT -> SERVER: EHLO localhost
    2020-04-04 09:48:32 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [2409:4072:79b:7a7f:646b:d8cb:d29f:2195]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
    2020-04-04 09:48:32 CLIENT -> SERVER: STARTTLS
    2020-04-04 09:48:33 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
    2020-04-04 09:48:41 CLIENT -> SERVER: EHLO localhost
    2020-04-04 09:48:42 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [2409:4072:79b:7a7f:646b:d8cb:d29f:2195]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
    2020-04-04 09:48:42 CLIENT -> SERVER: AUTH LOGIN
    2020-04-04 09:48:42 SERVER -> CLIENT: 334 VXNlcm5hbWU6
    2020-04-04 09:48:42 CLIENT -> SERVER: [credentials hidden]
    2020-04-04 09:48:42 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
    2020-04-04 09:48:42 CLIENT -> SERVER: [credentials hidden]
    2020-04-04 09:48:43 SERVER -> CLIENT: 535-5.7.8 Username and Password not accepted. Learn more at535 5.7.8 https://support.google.com/mail/?p=BadCredentials w16sm7501538pfj.79 - gsmtp
    2020-04-04 09:48:43 SMTP ERROR: Password command failed: 535-5.7.8 Username and Password not accepted. Learn more at535 5.7.8 https://support.google.com/mail/?p=BadCredentials w16sm7501538pfj.79 - gsmtp
    SMTP Error: Could not authenticate.
    2020-04-04 09:48:43 CLIENT -> SERVER: QUIT
    2020-04-04 09:48:43 SERVER -> CLIENT: 221 2.0.0 closing connection w16sm7501538pfj.79 - gsmtp
    SMTP Error: Could not authenticate.
    Message could not be sent. Mailer Error: SMTP Error: Could not authenticate.

    Please could you explain what it really means because i turned of the 'less secure app' in my google account but i still couldn't receive any message.

    Thanks

    Jai.

  5. Hi, with reference to chapter 10 and 16 of Mr. Larry's book "PHP 6 AND MYSQL 5 FOR DYNAMIC WEBSITES visual quickpro guide" low price edition, please i'll like to receive help from this forum too as well as to configure Xampp in order to be able to send mails.

    Please i'll be ever grateful if i can receive help from here. i have gone through various links and videos but to no avail did I succeed

    I as well watched this video on youtube inorder to configure mercury to send mails but still didn't succeed.

     

    Thank you.

  6. Hello i am new to this forum, with reference to Mr. Larry's book " PHP 6 AND MYSQL FOR DYNAMIC WEBSITES VISUAL QUICKPRO GUIDE" low price edition. Please, i have been trying to login a user for the  pass two days but i am not getting it right because i can't access the login page without activating the account which is done by clicking the the link in the email. So the problem is i don't receive the email after configuring the sendmail.ini and the php.in for the email, therefore i am stuck and i can't proceed. i even downloaded thunderbird for sending and receiving the emails and also configured the mercury  and added new users through on the control panel admin->configuration->manage users->Add...

    I even tried creating the simple login page that will not require the user to activate his account through the link using the example in chapter 11. But still couldn't get it right.

    Please i will really like to have help from this forum,

    Thank you.

×
×
  • Create New...