CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail »
  • Using IMAP2SOAP »
  • imap2soap.pl with free/web-based IMAP accounts?
Pages: [1] 2

Author Topic: imap2soap.pl with free/web-based IMAP accounts?  (Read 14329 times)

tomsanderson

  • Guest
imap2soap.pl with free/web-based IMAP accounts?
April 23, 2008, 03:35:26 pm
I realize it is not officially supported, but I seem to be having a problem I would imagine has happened to another user here before:

I am trying to hook it up to GMail through the new IMAP interface, and it seems, even with correct settings, to hang for a bit, and then time out at 30 seconds.  I got on the IRC Channel with a chap in NZ who tried it with a GMail account of his own, and was the same behavior.

Has anyone else run into this issue using imap2soap to pull IMAP from a "free" mail provider such as GMail, Yahoo, etc?  Is this a known issue with workarounds?

Thanks!

Tom Sanderson
tom@cultivatestudios.com

Chris Burgess

  • Ask me questions
  • ****
  • Posts: 675
  • Karma: 59
Re: imap2soap.pl with free/web-based IMAP accounts?
April 23, 2008, 05:44:55 pm
As Tom says, I was able to duplicate the issue with imap2soap.pl - it works quickly and well on my machine (connecting to a local IMAP box) but times out connecting to Gmail. Both Tom and I can connect to Gmail's IMAP via telnet from the machines that we're running imap2soap.pl on, using the same port / settings.

Any clues on why imap2soap would have trouble specifically with Gmail?

Anyone found a good workaround? Or have recommendations for other highly-available instant IMAP accounts?
@xurizaemon ● www.fuzion.co.nz

ymmatt

  • I’m new here
  • *
  • Posts: 29
  • Karma: 0
Re: imap2soap.pl with free/web-based IMAP accounts?
May 18, 2008, 09:18:56 pm
Its only been a couple of weeks, but has anyone made any progress on this? I've made it past the typical module based errors, but I'm stuck with this result from my trace:

Code: [Select]
# imap2soap.pl
imap2soap: Initializing http://domainname.com/sites/all/modules/civicrm/extern/soap.php
SOAP::Transport::HTTP::Client::send_receive: POST http://domainname.com/sites/all/modules/civicrm/extern/soap.php HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 522
Content-Type: text/xml; charset=utf-8
SOAPAction: "urn:civicrm#authenticate"

<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><authenticate xmlns="urn:civicrm"><c-gensym3 xsi:type="xsd:string">username</c-gensym3><c-gensym5 xsi:type="xsd:string">password</c-gensym5></authenticate></soap:Body></soap:Envelope>
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection: close
Date: Mon, 19 May 2008 04:13:06 GMT
Pragma: no-cache
Server: Apache/2.0.52 (CentOS)
Content-Length: 0
Content-Type: text/html; charset=UTF-8
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Client-Date: Mon, 19 May 2008 04:13:06 GMT
Client-Peer: ip-address:80
Client-Response-Num: 1
Set-Cookie: PHPSESSID=kfvo5tvptcv9u6uk97kd012a45; path=/
X-Powered-By: PHP/5.1.6

imap2soap: Fatal: During the SOAP initialization

I'm attempting to use this with a google apps email account, and I'm hoping this will work, as I can't find any other possible solutions for multi-site setups.

fen

  • I post frequently
  • ***
  • Posts: 216
  • Karma: 13
    • CivicActions
  • CiviCRM version: 3.3-4.3
  • CMS version: Drupal 6/7
  • MySQL version: 5.1/5.5
  • PHP version: 5.3/5.4
Re: imap2soap.pl with free/web-based IMAP accounts?
May 20, 2008, 06:57:05 pm
I'm not sure what the problem is, but "imap2soap: Fatal: During the SOAP initialization" is certainly not very helpful.  I've just uploaded a new imap2soap.pl with better error message reporting to https://svn.civicactions.net/repos/civicrm/scripts/imap2soap.pl

Please try that and report the error message you receive - maybe we'll be able to debug it.

ymmatt

  • I’m new here
  • *
  • Posts: 29
  • Karma: 0
Re: imap2soap.pl with free/web-based IMAP accounts?
May 21, 2008, 09:36:33 am

Well there is a new error now, everything  is the same above, but his is added to the bottom:

Code: [Select]
imap2soap: 1
imap2soap: Fatal: During SOAP initialization (Can't call method "fault" on an undefined value at /usr/local/bin/imap2soap.pl line 144.
)

speleo

  • Ask me questions
  • ****
  • Posts: 396
  • Karma: 28
  • CiviCRM version: 4.3.1
  • CMS version: J! 2.5,9
  • MySQL version: 5.1
  • PHP version: 5.3.24
Re: imap2soap.pl with free/web-based IMAP accounts?
May 21, 2008, 02:48:08 pm
regarding the first line

there is a small bug introduced in the latest version on line 104 where $text needs to be in brackets otherwise the output is "1" rather than the actual message.

Code: [Select]
sub verbose
{
  my ($text) = @_;
  return if $opt{q};
  printf STDERR "imap2soap: $text\n";
}

ymmatt

  • I’m new here
  • *
  • Posts: 29
  • Karma: 0
Re: imap2soap.pl with free/web-based IMAP accounts?
May 21, 2008, 04:34:50 pm
I applied that fix, but as I'm sure you expected not much changed:

Code: [Select]
imap2soap: Fatal: During SOAP initialization (Can't call method "fault" on an undefined value at /usr/local/bin/imap2soap.pl line 144.
)

fen

  • I post frequently
  • ***
  • Posts: 216
  • Karma: 13
    • CivicActions
  • CiviCRM version: 3.3-4.3
  • CMS version: Drupal 6/7
  • MySQL version: 5.1/5.5
  • PHP version: 5.3/5.4
Re: imap2soap.pl with free/web-based IMAP accounts?
May 21, 2008, 10:39:33 pm
(I've replaced the brackets arounf $text in verbose() - sorry about that!)

linkx

  • I post occasionally
  • **
  • Posts: 86
  • Karma: 7
Re: imap2soap.pl with free/web-based IMAP accounts?
May 26, 2008, 03:40:52 pm
Google Apps user here. Hoping to get CiviMail working with a Google Apps Gmail account. Any progress anyone?

dharmatech

  • I post frequently
  • ***
  • Posts: 280
  • Karma: 53
    • dharmatech.org
Re: imap2soap.pl with free/web-based IMAP accounts?
July 02, 2008, 08:32:54 pm
I was able to get my Google Apps account to work with imap2soap with a little extra code and a couple extra perl modules.  You'll need IO::Socket::SSL, which if I remember correctly also required Crypt::SSLeay and maybe something else (try just installing IO::Socket::SSL and it'll tell you what you need: perl -MCPAN -e "install IO::Socket::SSL").

Once that's installed, change your IMAP session code to something like this:
Code: [Select]
  my $imap = Mail::IMAPClient->new(
                                   Socket   => IO::Socket::SSL->new
                                        ( Proto => 'tcp',
                                          SSL_verify_mod => 0x00,
                                          PeerAddr => $imapHost,
                                          PeerPort => '993',
                                        ),
                                   User     => $imapUser,
                                   Password => $imapPass,
                                   UID      => 1,
                                   Clear    => 1, # no buffering
                                  )
    or die "imap2soap: Cannot connect to $imapHost as $imapUser: $@ \n";
}

Then here's the big gotcha: imap.gmail.com seems to be only an MX record (no A record) and Mail::IMAPClient seems to want to resolve via the A record which doesn't exist.  So in your imap2soap.conf file, set your $imapHost = 'gmail-imap.l.google.com';.

Most of the errors in this thread weren't the same errors I was getting, but this should at least help those who have SOAP part working and just need the Google Apps/IMAP part.

-Jeremiah 
http://dharmatech.org
oss@dharmatech.org
801.541.8671

jalama

  • I post frequently
  • ***
  • Posts: 176
  • Karma: 22
    • Rooty Hollow LLC
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6 and 7
  • MySQL version: 5.1
  • PHP version: 5.2.5 and 5.3
Re: imap2soap.pl with free/web-based IMAP accounts?
July 28, 2008, 08:47:21 am
any chance you are suing something other than 'INBOX as the value for $inBox?  I keep getting an error saying:

Could not find INBOX folder: Error sending '1 SELECT INBOX' to IMAP: No route to host

I've changed the name of inBox about 10 times to no avail.

same issue on regular gmail and google apps
http://www.rootyhollow.com

dharmatech

  • I post frequently
  • ***
  • Posts: 280
  • Karma: 53
    • dharmatech.org
Re: imap2soap.pl with free/web-based IMAP accounts?
July 30, 2008, 07:06:43 am
jalama, here's my line from imap2soap.conf:

 $inBox = 'INBOX';

Both my gmail and google apps accounts have this. Possibly you left off the semicolon?
http://dharmatech.org
oss@dharmatech.org
801.541.8671

jalama

  • I post frequently
  • ***
  • Posts: 176
  • Karma: 22
    • Rooty Hollow LLC
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6 and 7
  • MySQL version: 5.1
  • PHP version: 5.2.5 and 5.3
Re: imap2soap.pl with free/web-based IMAP accounts?
August 02, 2008, 08:18:12 am

dharmatech, Oh how I wish it were that easy

I have the same value, with semicolon for $inBox.

I realized I left out a line of the error message, it's below.  line 276 below is normally 269, I have a 7 lines of debugging code in my imap2soap.pl file

Code: [Select]
imap2soap: Initialization complete
Not connected at /etc/imap2soap.pl line 276
Error sending '1 SELECT INBOX' to IMAP: Connection timed out at /etc/imap2soap.pl line 276
imap2soap: Could not find INBOX folder: Error sending '1 SELECT INBOX' to IMAP: Connection timed out

If this helps.

I'm going to switch to a local e-mail set-up and see if that fixes things, help isolate the issue.





http://www.rootyhollow.com

dharmatech

  • I post frequently
  • ***
  • Posts: 280
  • Karma: 53
    • dharmatech.org
Re: imap2soap.pl with free/web-based IMAP accounts?
August 04, 2008, 05:48:52 pm
jalama,

I think that's what I was getting before I changed "$imapHost = 'gmail-imap.l.google.com';" and was trying to use imap.google.com initially.

Also make sure you have IMAP enabled in the preferences for the account.
http://dharmatech.org
oss@dharmatech.org
801.541.8671

jalama

  • I post frequently
  • ***
  • Posts: 176
  • Karma: 22
    • Rooty Hollow LLC
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6 and 7
  • MySQL version: 5.1
  • PHP version: 5.2.5 and 5.3
Re: imap2soap.pl with free/web-based IMAP accounts?
August 06, 2008, 08:11:39 am
Having moved to trying a local e-mail account, and getting the same result.  I'm getting to the point where I'm sure this is an issue with my server

I'm on MediaTemple, here are my phpinfo() soap settings, any of these raise red-flags

Directive   Local Value   Master Value
soap.wsdl_cache   1   1
soap.wsdl_cache_dir   /tmp   /tmp
soap.wsdl_cache_enabled   1   1
soap.wsdl_cache_limit   5   5
soap.wsdl_cache_ttl   86400   86400

Again here's the error
Code: [Select]
imap2soap: Initializing http://example.com/sites/all/modules/civicrm/extern/soap.php
imap2soap: Initialization complete
Not connected at /etc/imap2soap.pl line 276
Error sending '1 SELECT INBOX' to IMAP:  at /etc/imap2soap.pl line 276
imap2soap: Could not find INBOX folder: Error sending '1 SELECT INBOX' to IMAP: 


« Last Edit: August 06, 2008, 12:48:12 pm by jalama »
http://www.rootyhollow.com

Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail »
  • Using IMAP2SOAP »
  • imap2soap.pl with free/web-based IMAP accounts?

This forum was archived on 2017-11-26.