Reputation: 61
planning to use php imap functions, I'm trying to test the imap protocol from my local host, I didn't found telnet-ssl for mac but I can use openssl and get connected.
The problem is I can only login but I cannot select a mailbox, create a mailbox, get a list, … The only command I can run is capability which is not really useful.
Here is the command I typed (#) and answers I get (*)
# openssl s_client -connect imap.gmail.com:993
* CONNECTED(00000003)
* […]
* OK Gimap ready for requests from 77.xxx.xxx.xxx v7if3901328vdd.33
# a001 login myUserName myPassword
* OK myUserName firstname lastname authenticated (Success)
# a002 create testbox
* (nothing, I have to start a new session)
OR
# a002 list "*"
* (nothing, I have to start a new session)
OR
…
Not sure where the problem is,
Was someone able to fetch some mails successfully from gmail (or other) using imap on mac ? (I'm on osX10.6)
Upvotes: 1
Views: 685
Reputation: 14763
I think this may be a line-ending issue. Use the -crlf
switch and it should work:
-crlf
this option translated a line feed from the terminal into CR+LF as required
by some servers.
This is the command I've always used to test Gmail IMAP, and it's worked fine for me from a Mac:
openssl s_client -crlf -connect imap.gmail.com:993
Also, your LIST
command has bad syntax. You need two parameters, not one:
a002 list "" "*"
Upvotes: 2
Reputation: 30309
Use fetchmail
and procmail
to build a local mailbox. Create ~/.fetchmailrc
containing...
set postmaster your_local_username
set syslog
set daemon 10
set logfile fetchmail.log
poll "imap.gmail.com" proto imap port 993
user "[email protected]" password "password"
is your_local_username here keep ssl
Then setup procmail
to store the messages...
In your ~
folder, create .procmailrc
containing...
SHELL=/bin/bash
DEFAULT=$HOME/.mail/Maildir/
MAILDIR=$HOME/.mail/Maildir/
LOCKFILE=$HOME/.mail/.lock
LOGFILE=$HOME/.procmail/log
You may need to make these folders too, I forget.
To begin fetch mail with procmail do:
fetchmail -kFm "/usr/bin/procmail -d %T"
You can use something like mutt
to read the mail, personally I don't read mail manually that I'm doing a fetchmail with, I would use it for email automation, which is what procmail is good at, essentially you can create 'recipes' to filter, process and redirect messages.
Wikipedia has a reasonable starting point for learning more about procmail. The man fetchmail
and man procmail
pages also have a lot of useful info.
Upvotes: 1