[how to] send with Gmail SMTP

Solutions for other phpList version 2 users
Forum rules
Please do not ask questions here, this is for Solutions you have discovered or come across.

Re: [how to] send with Gmail SMTP

Postby mahoomeister » 4:12pm, Sat 08 Aug, 2009

Solved my problem! Here's the solution that worked for me using phplist 2.10.9:

TO PROCESS BOUNCES
In config/config.php:
Code: Select all
$bounce_mailbox_host = 'pop.gmail.com';
$bounce_mailbox_user = 'name@domain.com';
$bounce_mailbox_password = 'password';
$bounce_mailbox_port = "995/pop3/ssl";


In admin/processesbounces.php:
Code: Select all
function processPop ($server,$user,$password) {
$port = $GLOBALS["bounce_mailbox_port"];
if (!$port) {
//$port = '110/pop3/notls';
$port = '995/pop3/ssl';
}


TO SEND MAIL VIA SMTP
In config/config.php:
Code: Select all
$phpmailer_smtpuser = 'name@domain.com';
$phpmailer_smtppassword = 'password';
$phpmailer_smtpport = '465';


In admin/class.phplistmailer.php:
Code: Select all
//$this->Helo = getConfig("website");
$this->Helo = getConfig("PHPMAILERHOST");


In admin/phpmailer/class.smtp.php:
Code: Select all
$this->smtp_conn = fsockopen($host='ssl://smtp.gmail.com',


Note: I did have to contact my hosting company to get them to open the port to make the outgoing connection to pop.gmail.com on 995!

Hope this helps someone in a similar position to me!
mahoomeister
phpList newbie
 
Posts: 3
Joined: 2:05pm, Sat 08 Aug, 2009

Re: [how to] send with Gmail SMTP

Postby jeremykay » 5:49pm, Fri 21 Aug, 2009

This is how you can get gmail SMTP working without hard-coding the host and port in other scripts besides the config file.

1. Download the latest version of PHPMailer, which adds added TLS/SSL SMTP support starting with version 2.0.0 rc1
2. Overwrite the existing files in lists/admin/phpmailer/
3. Add the following lines to the lists/config/config.php
Code: Select all
$phpmailer_smtpsecure = 'ssl'; //ssl or tls or blank
$phpmailer_smtpport = 465;

4. Change /lists/admin/class.phplistmailer.php as follows
Code: Select all
         $this->SMTPAuth = true;
         //$this->Helo = getConfig("website");
         $this->Host = PHPMAILERHOST;

         $this->Username = $GLOBALS['phpmailer_smtpuser'];
         $this->Password = $GLOBALS['phpmailer_smtppassword'];
         $this->SMTPSecure = $GLOBALS['phpmailer_smtpsecure'];
         $this->Port = $GLOBALS['phpmailer_smtpport'];
jeremykay
phpList newbie
 
Posts: 4
Joined: 5:39pm, Fri 21 Aug, 2009

Re: [how to] send with Gmail SMTP

Postby acecarwash » 1:05pm, Thu 08 Oct, 2009

I still have a problem wenn sending a test email or a normal list email it is getting failed eatch time

Mine config.php:
Code: Select all
define ("TEST",0);
define("PHPMAILERHOST",'smtp.gmail.com');

$phpmailer_smtpuser = '<NAME>@gmail.com';
$phpmailer_smtppassword = '<PASSWORD>';
# Guy 08-10-2009
$phpmailer_smtpsecure = 'ssl'; //ssl or tls or blank
$phpmailer_smtpport = '465';


Mine class.phplistmailer.php
Code: Select all
/* # Guy 08-10-2009
 
       $this->SMTPAuth = true;
         $this->Helo = getConfig("website");
         $this->Host = PHPMAILERHOST;

         $this->Username = $GLOBALS['phpmailer_smtpuser'];
         $this->Password = $GLOBALS['phpmailer_smtppassword'];
*/
         $this->SMTPAuth = true;
         //$this->Helo = getConfig("website");
         $this->Host = PHPMAILERHOST;

         $this->Username = $GLOBALS['phpmailer_smtpuser'];
         $this->Password = $GLOBALS['phpmailer_smtppassword'];
         $this->SMTPSecure = $GLOBALS['phpmailer_smtpsecure'];
         $this->Port = $GLOBALS['phpmailer_smtpport'];
      
         #  logEvent('Sending authenticated email via '.PHPMAILERHOST);

         #  logEvent('Sending via smtp');
         $this->Mailer = "smtp";
# Guy 08-10-2009
      $this->IsSMTP();
      
      }


And de phpmailer debug:
Code: Select all
SMTP -> FROM SERVER: SMTP -> FROM SERVER: SMTP -> ERROR: EHLO not accepted from server: SMTP -> FROM SERVER: SMTP -> ERROR: HELO not accepted from server: SMTP -> ERROR: AUTH not accepted from server: SMTP -> NOTICE: EOF caught while checking if connectedZend test mail naar: ******************* mislukt

Am i missing some thing? Its a clean install with the newest version.

The logboek says:
Mailer Error: The following From address failed <EMAILADRES>
acecarwash
PL Nut
 
Posts: 15
Joined: 8:40am, Thu 08 Oct, 2009

Re: [how to] send with Gmail SMTP

Postby acecarwash » 5:01pm, Thu 08 Oct, 2009

FIXED FOR 2.10.10

lists/config/config.php
Code: Select all
define ("TEST",0);
define("PHPMAILERHOST",'smtp.gmail.com');

$phpmailer_smtpuser = '<NAME>@gmail.com';
$phpmailer_smtppassword = '<PASSWORD>';
# Guy 08-10-2009
$phpmailer_smtpsecure = 'ssl'; //ssl or tls or blank
$phpmailer_smtpport = '465';


lists/admin/class.phplistmailer.php

Code: Select all
$this->SMTPAuth = true;
//$this->Helo = getConfig("website");
$this->Host = PHPMAILERHOST;

$this->Username = $GLOBALS['phpmailer_smtpuser'];
$this->Password = $GLOBALS['phpmailer_smtppassword'];
$this->SMTPSecure = $GLOBALS['phpmailer_smtpsecure'];
$this->Port = $GLOBALS['phpmailer_smtpport'];


lists/admin/phpmailer/class.smtp.php
Code: Select all
       #connect to the smtp server
/* Guy 08-10-2009
        $this->smtp_conn = fsockopen($host,    # the host of the server
*/
# Guy 08-10-2009
$this->smtp_conn = fsockopen($host='ssl://smtp.gmail.com',
acecarwash
PL Nut
 
Posts: 15
Joined: 8:40am, Thu 08 Oct, 2009

Re: [how to] send with Gmail SMTP

Postby wieslawg » 2:34pm, Fri 04 Dec, 2009

Hi,

How and where I can to include code mentioned in 4)? I understand that I need to create a new section in class.phpmailer.php. Please more details.

4) Still in class.phplistmailer.php, edit the function PHPlistMailer so it looks like:
...
if (isset($GLOBALS['phpmailer_smtpuser])...
$this->SMTPAuth=true;
$this->SMTPSecure="ssl";
$this->Port=$GLOBALS['phpmailer_smtpport'];
$this->Username=$GLOBALS['phpmailer_smtpuser'];
$this->Password=$GLOBALS['phpmailer_smtppassword'];
...


Can you send real code? What about new versionPHPMailer 5.1?
wieslawg
phpLister
 
Posts: 8
Joined: 11:28am, Fri 19 Jun, 2009

Re: [how to] send with Gmail SMTP

Postby wieslawg » 9:30am, Wed 16 Dec, 2009

Hi,

I see a great interest in this problem and a number of proposals (in particular the class.phplistmailer.php). Might be a good solution to prepare proven and recommended solution for versions 2.0.x and 5.1.x.

Please, help me:)
wieslawg
phpLister
 
Posts: 8
Joined: 11:28am, Fri 19 Jun, 2009

Re: [how to] send with Gmail SMTP

Postby jmarston » 9:39pm, Wed 13 Jan, 2010

I'm installing the php on godaddy, and can send fine, but how to process the bounces?

I get error: IMAP is not included in your PHP installation, cannot continue
Check out http://www.php.net/manual/en/ref.imap.php

If we use gmail to take the bounces...will phplist still be able to "process them" to clean the list up?

I see....
Error: IMAP is not included in your PHP installation, cannot continue. There is a major confusion that has been caused by the PHP developers naming a PHP module the IMAP module, even though it is used for more than just IMAP. phpList needs the IMAP functions in PHP in order to connect to the mailbox that will hold the bounces. The mailbox itself is a POP3 mailbox, or you can configure it to be a local mailbox files, but whatever the situation, the IMAP functions are necessary. IMAP functions in PHP have nothing to do with the actual IMAP protocol (at least not as far asphpListis concerned). You should be able to solve this issue by installing (and compiling) the IMAP module into PHP. If you are on a shared hosting account, you should contact your hosting provider.

So I'm on with godaddy support to see how to light up the imap functions in php (which are disabled by default)
jmarston
phpList newbie
 
Posts: 1
Joined: 7:57am, Mon 11 Jan, 2010

Re: [how to] send with Gmail SMTP

Postby kremmerz » 7:02pm, Thu 14 Jan, 2010

Hello, Im'trying to use phplist for the first time.
I have my domain under google apps. I'm hosting it on a godaddy's server.

Here is my problem: phplist works with test messages but not with newsletter messages. They remain in the queue section after the time of processing.

I've changed my phplist as suggested here by mahoomeister on 4:12pm, Sat 08 Aug, 2009 and by acecarwash only on 5:01pm, Thu 08 Oct, 2009.
Then I add some users (confirmed) and put them inside a new list (activated). Then I follow the "send message" procedure that we can find in the support section here on phplist network.
Then I click on "process queue" and it says:
"Started
Script stage: 6
Finished, Nothing to do
Finished, All done"

Then I go in the queue tab inside the messages section: all messages remain here. Always 0 messages in the "sent" tab. If I click on a message in the queue "tab" section and look at the bottom, it says "Lists this message has been sent to: my list name". But this is not true. I don't receive anything.
Do I have to wait many hoursa after the scheduled time? Am I doing something wrong? Am I missing some important step in the php list configuration for gmail?

It' really strange that I can send and receive "test messages" only!!!

Please, help me!
kremmerz
phpList newbie
 
Posts: 1
Joined: 6:46pm, Thu 14 Jan, 2010

Re: [how to] send with Gmail SMTP

Postby kaclem » 12:16pm, Fri 08 Jul, 2011

Here is my problem: phplist works with test messages but not with newsletter messages. They remain in the queue section after the time of processing.

i have similar problem. can anyone give some advice?
kaclem
phpList newbie
 
Posts: 1
Joined: 12:14pm, Fri 08 Jul, 2011

Re: [how to] send with Gmail SMTP

Postby crazybusy » 2:55am, Sun 17 Jul, 2011

Here is my problem: phplist works with test messages but not with newsletter messages. They remain in the queue section after the time of processing.


Under "Send a message" On the tab Lists - make sure you select a LIST or "recipeints" for your email. Basically sending email goes like this.

1. Create a message
2. Go to tab lists
3. Select list
4. Send Campaign.
5. Now go to messages, under the tab "queued" make sure it's there.
6. Hit Process QUEUE on the menu on the right.
crazybusy
phpList newbie
 
Posts: 3
Joined: 1:50pm, Thu 22 Apr, 2010

Re: [how to] send with Gmail SMTP

Postby bigRoN18 » 10:13am, Tue 19 Jul, 2011

I am not using Gmail for PHPList, but I am wishing to use SMTP Relay from within my GoDaddy account which uses SSL and port 465 for SMTP. Instead of PHPMailer 2.0, I've tried 5.1. Also, I am on the current version of PHPList ( 2.10.14). I have tried to follow the steps put forth by everyone that says they have it working with Gmail except for substituting the URL for SMTP server. Examples of what I've done...

/admin/class.phplistmailer.php
Code: Select all
require( dirname(__FILE__) . '/phpmailer5/class.phpmailer.php');
require_once(
 dirname(__FILE__) . '/phpmailer5/class.pop3.php'); // POP before SMTP
require( dirname(__FILE__) . '/phpmailer5/class.smtp.php');
...
...
...
 if (defined('PHPMAILERHOST') && PHPMAILERHOST != '') {
        //logEvent('Sending email via '.PHPMAILERHOST);
        $this->SMTPAuth = true;
        //$this->Helo = getConfig("website");
        $this->Helo = getConfig("PHPMAILERHOST");
        $this->Host = PHPMAILERHOST;
        //begin EDIT
     if (isset($GLOBALS['phpmailer_smtpport']) && $GLOBALS['phpmailer_smtpport'] != '') {
         if($GLOBALS['phpmailer_smtpport'] == '465'||$GLOBALS['phpmailer_smtpport'] == '995')
            {
            $this->SMTPSecure="ssl"; 
            
}
         $this->Port=$GLOBALS['phpmailer_smtpport']; 
      
}
      if (isset($GLOBALS['phpmailer_smtpuser']) && $GLOBALS['phpmailer_smtpuser'] != '') {
           $this->SMTPAuth=true; 
         $this
->Username=$GLOBALS['phpmailer_smtpuser']; 
         $this
->Password=$GLOBALS['phpmailer_smtppassword']; 
#        logEvent('Sending authenticated email via '.PHPMAILERHOST);
      }     
     
//end EDIT
        $this->Mailer = "smtp";
        $this->IsSMTP();
 


I had tried the POP before SMTP but ended up commenting it out, as I got errors with it too. I left the "reequire_once" for the POP before SMTP uncommented out because I figured there was no harm. I obviously put PHPMailer 5.1 into the directory "/admin/phpmailer5".

/admin/phpmailer5/class.smtp.php
Code: Select all

function SMTP
() {
    //$this->smtp_conn = 0;
    $this->smtp_conn = fsockopen($host='ssl://smtpout.secureserver.net');
    $this->error = null;
    $this->helo_rply = null;

    $this->do_debug = 0;
  } 


In the recommendation to change the line with the "fsockopen" in it, there appeared to be a syntax error... the line ended with "fsockopen($host='ssl://smtp.gmail.com'," when (with changing for different service), "fsockopen($host='ssl://smtpout.secureserver.net');"


FINALLY... /config/config.php
Code: Select all

define
("PHPMAILER",1);
 
define
("PHPMAILERHOST",'smtpout.secureserver.net');

$phpmailer_smtpuser = '<MyEmailAddress>';
$phpmailer_smtppassword = '<MyPassword>';
$phpmailer_smtpport = '465';
$phpmailer_smtpsecure = 'ssl'; //ssl or tls or blank
$phpmailer_popuser = $bounce_mailbox_user; //or your mail adress like for classical auth
$phpmailer_poppassword = $bounce_mailbox_password; //or your mail password like for classical auth
 


Despite all this, I constantly get "Mailer Error: SMTP Error: Could not connect to SMTP host" in the event log. Can anyone point out where I went wrong?
bigRoN18
PL Nut
 
Posts: 21
Joined: 4:20am, Tue 24 Feb, 2009
Location: Roseville, CA

Re: [how to] send with Gmail SMTP

Postby enclaves » 10:43am, Tue 20 Mar, 2012

Can someone please upload or copy paste the whole coding for the following files: (WHICH IS WORKING)

list/admin/class.phplistmailer.php

list/config/config.php

I am getting the following error: Sent test mail to: xxxxxxatxxdotcom failed
enclaves
phpList newbie
 
Posts: 1
Joined: 10:38am, Tue 20 Mar, 2012

Re: [how to] send with Gmail SMTP

Postby axidz » 9:21pm, Wed 21 Aug, 2013

Hey Guys!

I've Followed The Guide - Managed to configure everything correctly - Getting Failed To Send message...

I'm 100% Sure my configuration is correct.
Google sent me an email saying that there was a server trying to establish a connection.

-Now the real question is if Google Apps is a must? if yes, any idea where should i look into there?
-SSL Enabled on host is also a must?( I Have Shared-SSL)

Thank You In Advance!

Kirill.
axidz
phpLister
 
Posts: 7
Joined: 6:51pm, Sat 29 Jun, 2013

Re: [how to] send with Gmail SMTP

Postby axidz » 4:25pm, Sat 24 Aug, 2013

Upgraded Host Account - now i have private SSL Connection.

I Guess have an Issue With Connecting to Gmail - And Gmail knows i'm trying to connect to it(I'm Getting Connection emails from Gmail)...

How Do I Sort It Out?
Anyone?

Thank you in advance.
axidz
phpLister
 
Posts: 7
Joined: 6:51pm, Sat 29 Jun, 2013

Re: [how to] send with Gmail SMTP

Postby zotek » 5:34pm, Mon 21 Oct, 2013

hi im using lates phplist version . my question is do i still need to download phpmailer since
i already have phpmailer 5.2.5 dir that comes with phplist?

thanks
zotek
PL Nut
 
Posts: 17
Joined: 7:30am, Mon 11 Mar, 2013

Previous

Return to Answers, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 1 guest