Importing emails from GMAIL using IMAP

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).

Importing emails from GMAIL using IMAP

Postby billy4eggs » 2:51am, Wed 23 Jan, 2013

Hi All,

Trying to import email addresses from my GMAIL Account using the inbuilt IMAP importer within PHPlist but just getting errors.

Has anybody done this before and what are the correct settings?

Thanks
Billy
billy4eggs
phpLister
 
Posts: 6
Joined: 8:06am, Tue 01 Jan, 2013

Re: Importing emails from GMAIL using IMAP

Postby JacobN » 5:36pm, Wed 23 Jan, 2013

Hello Billy,

I took a look at this issue for you, and unfortunately I wasn't able to come up with the correct settings to allow it to work with Gmail. The issues I found are that Gmail uses port 993 for their IMAP service instead of the default 443, and they also require an SSL connection to them.

I found that in the /lists/admin/import3.php script there are two sections that cause it to not be able to connect to Gmail's IMAP servers:

Lines: 136-138
Code: Select all
function processImapFolder($server,$user,$password,$folder,$fieldlist = array()) {
$result = array();
$port =  "143/imap/notls";


Lines: 167-168
Code: Select all
function getImapFolders($server,$user,$password) {
$port =  "143/imap/notls";


I tried to play around with some various supposedly functioning ways to connect to Gmail over IMAP that I found with some searches, but none of them worked for me:

Code: Select all
$port =  "993/imap/ssl/novalidate-cert"


Code: Select all
$port =  "993/ssl/novalidate-cert"


Code: Select all
$port =  "993/imap/ssl"


So it's something deeper it looks like with how phpList is trying to handle the IMAP folders as well I believe. Because I was able to confirm on the same server if I manually setup my own PHP script using this to connect to Gmail's servers I could do it successfully:

Code: Select all
<?php

$host = '{imap.gmail.com:993/imap/ssl}INBOX';
$user = 'username@gmail.com';
$pass= 'PassWord;

$inbox = imap_open($host,$user,$password) or die('Can't connect to Gmail: ' . imap_last_error());


So you might be able to create your own separate PHP script to connect to your Gmail account to export addresses into a tab or comma delimited list, and then you can import that into phpList directly. I have a guide on how to import users into phpList that goes over importing a group of users from a file if you get that far with it.

Alternatively you might be able to also setup another IMAP account offsite from Gmail where the server doesn't use SSL and can just use the default port 143. Then move over all your Gmail mail into that account, and have phpList try to import over IMAP from that account. Of course I'd recommend first giving it a shot with a test message in the new account before going through all the trouble of moving over your Gmail email to see if it does in fact work.

Hope that helps steer you in the right direction, let me know if that works for you if you give it a shot.

- Jacob
JacobN
PL Nut
 
Posts: 33
Joined: 4:34pm, Tue 01 Jan, 2013


Return to Question & Problems - after installing

Who is online

Users browsing this forum: Exabot [Bot] and 1 guest