Config Issues

Help
Nyle Davis
2013-09-24
2013-09-24
  • Nyle Davis

    Nyle Davis - 2013-09-24

    All,

    I have PHPMailer working off a Test file calling:

    /var/www/Projects/Internal_Projects/Emailer/PHPMailer/class.phpmailer.php

    which is Version 5.1 and vastly different from the class.phpmailer.php files for the installed UI versions at:

    /var/www/OS-packages/lists/ version 5.0

    /var/www/OS-packages/PHPMailer_5.2.0/ version 5.2

    Neither of the last 2 will work always giving the errors of:

    SMTP -> ERROR: EHLO not accepted from server:
    SMTP -> ERROR: HELO not accepted from server:
    SMTP -> ERROR: AUTH not accepted from server:
    SMTP -> NOTICE: EOF caught while checking if connected

    This is because Gmail, which I'm using for SMTP requires:

    define ('EM_ATH',true); 
    define ('EM_PRT',465);
    define ('EM_HST','smtp.googlemail.com');
    define ('EM_SEC','ssl');    
    define ('EM_UID','gmailUserID');
    define ('EM_PWD','gmailUserPWD');
    define ('EM_APD','gmailAltPWD');    
    define ('EM_AUD','gmailAltID');
    

    And in the UI there is no option to set the "Security" to SSL that is required. But since there is in my test file and it still does not work, something seriously wrong between the 3 files.

    So what file to I intersect and where/how do I set this value.

    For my Test file:

    <?php
        include('config.php');
        require_once ('/var/www/Projects/Internal_Projects/Emailer/PHPMailer/class.phpmailer.php');
        //require_once ('/var/www/OS-packages/PHPMailer_5.2.0/class.phpmailer.php');
        //include_once ('/var/www/OS-packages/lists/admin/phpmailer/class.phpmailer.php');
        error_reporting(E_ALL);
        ini_set("display_errors", 1);
        $Mail = new PHPMailer();                                        // Start PHPMailer
        $em_switch          =   0;                                          // Determine which to/from combo
        $em_to              =   EM_AUD;                                 // Default EMail "TO"
        $em_frm             =   EM_UID;                                 // Default EMail "FROM"
        $em_nm              =   'Anybody';                          // Default EMail "NAME"
        $em_sub             =   'Test Subject';                     // Default EMail "SUBJECT"
        $em_pwd             =   EM_PWD;                                 // Default EMail "PASSWORD"
        $em_apw             =   EM_APD;                                 // Alternate EMail "PASSWORD"
        $Mail->IsSMTP();                                                    // Set to SMTP
        $Mail->SMTPAuth   = EM_ATH;                             // enable SMTP authentication
        $Mail->Host         =   EM_HST;                                 // Set Host
        $Mail->Port         =   EM_PRT;                                 // set the SMTP server port
        $Mail->SMTPSecure   =   EM_SEC;                                 // Set SMTP security
        $Mail->SMTPDebug    =   1;                                          // Turn on SMTP debugging
        if ($em_switch<>1) {                                                // Send EMail from davisoftaec@gmail.com
            $Mail->Username   = $em_frm;                            // SMTP server username
            $Mail->Password   = $em_pwd;                            // SMTP server password
            $Mail->AddAddress   ($em_to);
            $Mail->From       = $em_frm;
        } else {                                                                // Send EMail from tbotnik@gmail.com
            $Mail->Username   = $em_to;                             // SMTP server username
            $Mail->Password   = $em_apw;                            // SMTP server password
            $Mail->AddAddress   ($em_frm);
            $Mail->From       = $em_to;
        }   // end if $em_switch
        $Mail->FromName   = $em_nm;
        $Mail->Subject      =   $em_sub;
        $Mail->CharSet      = 'UTF-8';  
        $Mail->IsHTML('true');
        $Mail->Body         = "<body><h2>Heading</h2><div>Test Content</div></body>";
        try {
            if ($Mail->Send()) { echo "Mail successfully sent! <br>"; }
        }   catch (phpmailerException $e) {
            echo "Mail not sent! $e->errorMessage() <br>";
        }   // end try/catch
    ?>
    

    You see I put these into my "config.php" file. As you see I tried to test this with the 5.0 and 5.2 files but always get the error described.

    Cheers!

    OMR

     
    Last edit: Nyle Davis 2013-09-24

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks