I need to write an IMAP wrapper around some messaging system.
With all the complexity of IMAP protocol i'd rather use some existing library to do the heavy lifting for me.
Are there any IMAP servers / libraries / frameworks available in PHP or Python?
Alternatively, is there such IMAP server which would allow to write a driver to use custom messaging system as a backend?
If you do not mind using Java then, Apache James IMAP provides RFC2040 compliant data access layer for IMAP. It is not fully optimized for performance yet but appears to be tested and in working condition otherwise. They also provide a full IMAP server and because everything is under Apache license, you should be able to use it as is or modify it any way you feel like.
The Python library for writing protocol servers and clients with probably the best reputation is Twisted. It contains an implementation of an IMAP server (twisted.mail.imap4.IMAP4Server). From a quick glance, it seems you'd need to wrap your "mail boxes" in this interface.
(Note though that I never used this class and I'm not sure if this really works as I expect it to work.)
Related
I'm currently exposing a WebDAV server using SabrePHP which allows me to expose a virtual filesystem based on a MongoDB database and a GridFS implementation to store files.
Now, it works quite well with Cyberduck, but here's the problem, only with Cyberduck. I smashed my head against the walls more than once to make the authentication work with the Windows built-in DAV client implementation just to see that it required special headers and authentication strategy to work.
So I'd like to know if there is any kind of alternative to WebDAV. My first thought was FTP, but I don't know if it is possible to expose an FTP "server" in PHP (cheating with the protocol in some dark apache configuration), and if it will work with my whole filesystem stored in database.
I have some PHP code in which XML data is being passed between server and client using sockets. socket_create( AF_INET, SOCK_STREAM, SOL_TCP ), socket_read(), socket_write() are the functions being used to pass XML and not HTTP requests.
Now if I want to use a proxy for client to use to connect through to the server, how can I do that in PHP?
I am new to sockets and from what I have gathered, there exists this library https://github.com/clue/php-socks which I don't fully understand right now but the idea is to setup the middleman using the same library which is essentially the proxy in this case. How would I go about using a SOCKS4/5 proxy obtained from https://www.socks-proxy.net/ or paid ones? Is the above mentioned library the only option? Feels like PHP should have something built in already.
Please advice.
This should be a comment, but it's a bit long.
Feels like PHP should have something built in already
I'm struggling to imagine why it should. PHP is a language designed for serverside web development. Proxies are a client side technology. Having said that the curl extension has comprehensive support for HTTP proxies.
There is no single proxy protocol. Certainly SOCKS and HTTP are the most visible protocols for proxies but there are lots more. Was there a specific reason for choosing SOCKS?
If it were me I would just setup transparent port forwarding using iptables (Linux) or a socat instance or haproxy (Unix, MSWindows).
How can I change password of the mail account using php. I am using IMAP functions.
IMAP doc : http://php.net/manual/en/book.imap.php
Note: There is no acess to cpanel API
If you don't have access to the cPanel API, then you're even less likely to have root access to the various files that would be needed to make the changes.
Changing passwords is not a feature of IMAP, POP or SMTP - it's a server configuration issue, so you need to manipulate the server configuration. Several hosts provide APIs (such as cPanel / Hostgator) but you've ruled that out, so he only other option would be "exec", and I wouldn't touch that with a bargepole for cPanel, Plesk or simlar as you'd also need ot manuliplate the databases that store the configs. Ouch, if if you had root access.
Edit: A bit more reasearch and I have found this: http://trac.roundcube.net/browser/github/plugins/password/password.php that supports several back ends. However the cPanel option uses the cPanel API; so still no luck!
What you could try is mailpw_change. It is not really PHP, but a simple HTML UI with a Python script that is called underneath (which you could adapt to your needs as it's super-simple).
I know there is plenty of PHP mail libraries out there, but most of them are designed to send emails, is there any library that will help me fetch emails from imap/pop3 accounts, deal with attachments etc?
I'm already using imap_* functions from PHP IMAP extension but using it is problematic, as I have to re-invent the wheel in most cases (ie. parsing the result of imap_fetchstructure to get to attachments)
Mayby there is any ready to use lib build on top of imap_* or similar, that will help me deal with fetching mails, without re-writing all that logic behind well known problems?
I have missed the obvious Zend_Mail will do the trick
Here is a PHP Pop3 Client that I use for a script on my server.
http://www.phpclasses.org/package/2-PHP-Access-to-e-mail-mailboxes-using-the-POP3-protocol.html
You could easily use that to create a graphical layout, but I have not had the necessity for it.
I'm looking for either an ASP.net or PHP based webmail app I can install on my shared hosting.
I want to set this up on one of my domains for my Gmail address, due to Gmail being blocked at work.
I'd like the interface to be as similar to Gmail as possible, conversation view, labels, starred emails etc if possible well at least allow me to keep with my GTD workflow.
Any suggestions?
The closest one I know of is Roundcube, but I'd be glad to find anything closer! Roundcube is written in PHP. The only thing about Roundcube which reminds me of Gmail is the simplicity and AJax drag-and-drop.
From their website:
(source: roundcube.net)
Roundcube webmail...
...is a
browser-based multilingual IMAP client
with an application-like user
interface. It provides full
functionality you expect from an
e-mail client, including MIME support,
address book, folder manipulation,
message searching and spell checking
For .Net you might try http://mail.afterlogic.com. There is a list of mostly php applications at http://www.noupe.com/ajax/10-ajax-webmail-clients.html. Though nothing close to the interface you get with gmail.
If it's just webmail interfaces (using AJAX) you're looking for, then here are some candidates (RoundCube was already mentioned) :
http://roundcube.net/
http://atmail.org/
http://www.afterlogic.com/mailbee/webmail-lite.asp
http://www.horde.org/dimp/
Consider using SSH to proxy HTTP. Or, you can try a proxy written in PHP... or simply use someone else's proxy somewhere. Have you tried using Google's Translate feature to access to Gmail (use Google as a proxy to Google)? Sometimes this is enough to break basic web filtering.
The advantage to a proxy is keeping the GMail interface completely intact.
I'd recommend AfterLogic's WebMail Lite (although it's not free, has versions in both PHP and ASP.NET). You can try out a live demo (ASP.NET version) here.
Taken from their site, here are some features:
Screenshot
(source: afterlogic.com)
>
>
Functionality
Multiple domains
Mail folders and nested folders
Address Book (Contacts and Groups)
Mail filters
Mail Search
IMAP synchronization
IMAP quotas
IMAP search
Managing IMAP folders
Delivery confirmation
Auto-responder (vacation message)
Compatibility
Supports SMTP/IMAP/POP3/XMail protocols
MySQL, MS SQL or MS Access database backend
Supports AJAX in all modern browsers: IE6+, Firefox, Chrome, Safari, Opera
Static HMTL option if AJAX not available
International charsets, including UTF-8
Accurate e-mail parser and viewer
Usability
Message preview pane
Auto-complete of e-mail addresses
Keyboard shortcuts
Spell-check
Compose e-mails in HTML (WYSIWYG) or plain-text modes
Right-to-left (RTL) rendering for Arabic and Hebrew
Built-in and user-defined skins
Personal user settings
Web administration panel (manage system settings and domains)
Security
Supports SSL connections with mail servers
Can block javascript and external images in e-mails
Spam filter with self-learning
Anti-virus integration
Deployment
cPanel integration (how)
Web-based installation wizard
Basic integration (bypass login screen)
Source code provided (modification allowed)