3 Topics: A.) GMAIL, B.) Send Test Email, C.) Templates

Once you've installed phpList Version 2... ask questions here!
Forum rules
Please help the volunteers to help you by supplying the version of phpList you are using, browser & version and if possible, a link to your phpList installation. This is for Version 2 of phpList (the orange one).

3 Topics: A.) GMAIL, B.) Send Test Email, C.) Templates

Postby TBotNik » 7:00pm, Mon 05 Aug, 2013

All,

I have these topics that I need help with:

  • GMail:

    I have been following the thread at:

    viewtopic.php?t=8715

    to try to get emails to send via GMail SMTP. Nothing has worked. I had previously installed PHPMailer, which is base emailer engine/code for this package, and had to have this code in my PHPMailer config.php file to work:
    Code: Select all
       $CFG['smtp_debug']               =   1;
       $CFG['smtp_server']               =   'smtp.gmail.com';
       $CFG['smtp_port']               =   '465';
       $CFG['smtp_authenticate']         =   'true';
       $CFG['smtp_username']            =   'mygmaillogin';
       $CFG['smtp_password']            =   'mygmailpassword';
       $CFG['smtp_security']            =   'ssl';

    stmp.googlemail.com is also acceptable.

    Anyway the test file for PHPMailer calls all this with:
    Code: Select all
       $Mail = new PHPMailer();                     // Start PHPMailer
       $Mail->IsSMTP();                        // Set to SMTP
       $Mail->SMTPAuth     =   $CFG['smtp_authenticate'];
       $Mail->Host          =   $CFG['smtp_server'];
       $Mail->Port          =   $CFG['smtp_port'];
       $Mail->SMTPSecure   =   $CFG['smtp_security'];
       $Mail->SMTPDebug   =   1;                  // Turn on SMTP debugging
       $Mail->Username     =   $CFG['smtp_username'];
       $Mail->Password     =   $CFG['smtp_password'];

    But find no config vars in the PHPList config.php file that a.) Turn on SMTP vs SendMail and SendMail always times out and errors, so must send via SMTP, b.) Invokes Authentication, c.) Correctly addresses smtp_security, d.) turns on debug.

    Therefore have not gotten GMail to work yet.

  • Send Test EMails:
    This never works at all from any page (available) with any emai address, whether in users list or not. Should be able to send to any email address whether in "users" or not, but even emails in "users" do not work.

  • Templates:
    I need a template that grabs changing variables as placeholders and other content from the database. Example this newsletter sends out topics cover 2 weeks (this week which is "Week #32" and next week "Week #33" and has a list of questions, for each week and their answers ("A's" post at bottom of newsletter) which can be pulled from the DB.

    Can I do this by writing this template as PHP, or is there another way to tackle this?

Cheers!

TBNK
TBotNik
PL Nut
 
Posts: 33
Joined: 9:26pm, Thu 04 Oct, 2012

Re: 3 Topics: A.) GMAIL, B.) Send Test Email, C.) Templates

Postby TBotNik » 7:32pm, Thu 08 Aug, 2013

All,

Can I get some help here?

TBNK
TBotNik
PL Nut
 
Posts: 33
Joined: 9:26pm, Thu 04 Oct, 2012

Re: 3 Topics: A.) GMAIL, B.) Send Test Email, C.) Templates

Postby TBotNik » 6:43pm, Thu 26 Sep, 2013

All,

What are the actual vars that PHPList uses to set these in it's config file?

Cheers!

TBNK
TBotNik
PL Nut
 
Posts: 33
Joined: 9:26pm, Thu 04 Oct, 2012

Working

Postby TBotNik » 7:34pm, Thu 26 Sep, 2013

All,

OK following (partly) the thread at:

viewtopic.php?t=17376

I changed ../lists/config/config.php to read:
Code: Select all
define("PHPMAILERHOST",'smtp.gmail.com');
$phpmailer_smtpuser='your Gmail address';
$phpmailer_smtppassword='your Gmail password';
$phpmailer_smtpport=465;


But had to mod entire "function PHPlistMailer" in "class.phplistmailer.php" as follows, as code has changed from listing in the thread under new versions:
Code: Select all
      function PHPlistMailer($messageid,$email) {
         #  parent::PHPMailer();
         parent::SetLanguage('en', dirname(__FILE__) . '/phpmailer/language/');
         $this->addCustomHeader("X-Mailer: phplist v".VERSION);
         $this->addCustomHeader("X-MessageID: $messageid");
         $this->addCustomHeader("X-ListMember: $email");
         #      $this->addCustomHeader("Precedence: bulk"); #http://mantis.phplist.com/view.php?id=15562
         $this->CharSet = getConfig("html_charset");

         if (defined('PHPMAILERHOST') && PHPMAILERHOST != '') {
            //logEvent('Sending email via '.PHPMAILERHOST);
            $this->Helo = getConfig("website");
            $this->Host = PHPMAILERHOST;
            if (   isset($GLOBALS['phpmailer_smtpuser']) &&
               $GLOBALS['phpmailer_smtpuser'] != '' &&
               isset($GLOBALS['phpmailer_smtppassword']) &&
               $GLOBALS['phpmailer_smtppassword'] != '' &&                
               isset($GLOBALS['phpmailer_smtpsecurity']) &&
               $GLOBALS['phpmailer_smtpsecurity'] != '' &&
               isset($GLOBALS['phpmailer_smtpport']) &&
               $GLOBALS['phpmailer_smtpport'] != ''
               ) {
               $this->SMTPAuth      = true;
               $this->SMTPSecure      = $GLOBALS['phpmailer_smtpsecurity'];
               $this->Port            = $GLOBALS['phpmailer_smtpport'];
               $this->Username      = $GLOBALS['phpmailer_smtpuser'];
               $this->Password      = $GLOBALS['phpmailer_smtppassword'];
            } else {
               echo "Email SMTP connection info not complete! <br>";
            }   // end if isset $GLOBALS
            $this->Mailer = "smtp";
            $this->IsSMTP();
         } else{
         #  logEvent('Sending via mail');
         $this->Mailer = "mail";
         }   // end if defined
         //$ip = gethostbyname($this->Host);
         if ($GLOBALS["message_envelope"]) {
            $this->Sender = $GLOBALS["message_envelope"];
            $this->addCustomHeader("Errors-To: ".$GLOBALS["message_envelope"]);
         }   // end if $GLOBALS
      }   // end function PHPlistMailer

This is because the line: //$ip = gethostbyname($this->Host); used in old code errors on most systems because they are not php 5.2>.

Right code for this that works regardless of php version is: $ip = exec ( 'hostname' );

Anyway after these changes the queue started processing and email were sent.

Still having other problems with NAV in the program which are documented at:

viewtopic.php?f=3&t=38318

Cheers!

TBNK
TBotNik
PL Nut
 
Posts: 33
Joined: 9:26pm, Thu 04 Oct, 2012


Return to Question & Problems - after installing

Who is online

Users browsing this forum: No registered users and 3 guests