Implementation: How to retrieve and send emails for different Gmail accounts? - php

I need advice and how to got about setting up a simple service for my users. I would like to add a new feature where users can send and receive emails from their gmail account. I have seen this done several times and I know its possible.
There use to be a project for "Libgmailer" at sourceforge but I think it was abandoned. Is anyone aware of anything similar?
I have found that Gmail has a Python API but my site is making use of PHP.
I really need ideas on how to best go about this!
Thanks all for any input

any library/source that works with imap or pop will work.

Well if Google didn't come up with anything personally I'd see if I could reverse engineer the Python API by implementing it and watching it with a packet sniffer. My guess is it's just accessing some web service which should be pretty easy to mimic regardless of the language you're using.

Just a thought, Gmail supports POP/IMAP access. Could you do it using those protocols? It would mean asking your users to go into their gmail and enable it though.

Related

Need help in Gmail Integration in my Application

I want to integrate Gmail (googleApps) into my application. I have created a PHP Imap library which will give me my required emails it is very slow and takes a lot of time during execution. I heard that Gmail (googleApps) is beginning to provide an interface that we can directly show in our web page. If we have something like this by using any third party API or google API please help me.
Thanks in advance.
I will give you a short answer. You don't have a detailed question you want someone to help you find something? Then maybe this is what you are looking for:
Google for
walsh gmail-php-imap

Webmail client with google imap

Im developing a webmail client using Zend framework and gmail IMAP.
Features like moving email from one folder to another ,Flagging,
mail composing,Drafts etc.
Simply it should reflect the same way as you see in the Gmail.
Technically Can any body point me towards right direction.? I mean the zend library supports REST ,JSON,IMAP,
As far as database is concerned im fine and im able to get all the data around 100 MB of data im able to store.
How should my approach be as far as architecture is concerned.Does REST & GMAIL IMAP combinedly can be used to perform manipulations ?
because always the server should always get new mail instantly may be at 5-10 min gap .
PLEASE Advise.
Also does gmail provide REST support to get new emails? OR we have to develop REST SERVER and consume the Rest client?
Also i would appreciate good hyper links to point over for kind of architecture.
Thanks
Mark
Technically Can any body point me towards right direction.? I mean the zend library supports REST ,JSON,IMAP,
These three acronyms have nothing do to with each other.
REST is an architectural philosophy.
JSON is a data encoding format.
IMAP is a protocol for accessing mailboxes.
Yes, Zend Framework has components that deal with all of these things, but that doesn't mean you have to use all of them.
If you want to access your Gmail account through IMAP, then use one of the Zend_Mail_Storage classes.
Does REST & GMAIL IMAP combinedly can be used to perform manipulations ?
If by that you mean "Can I write a RESTful application that uses IMAP to communicate to Gmail?", then the answer is yes, yes you can.
the server should always get new mail instantly may be at 5-10 min gap
It sounds like you want a cron job running to continuously poll the server for mail, instead of using an active IMAP connection live whenever the user is making requests.
Also does gmail provide REST support to get new emails?
It took them years to give us just basic IMAP support, I don't think we're going to see a RESTful API out of them any time soon. Keep in mind that they earn money based off of ad views. You aren't viewing ads when you use IMAP.
Also i would appreciate good hyper links to point over for kind of architecture.
Are you kidding? No, really, look at what you're doing. You're building a webmail client designed to access another webmail client. Do you realize how incredibly silly that is, my friend? You're re-inventing a re-invented wheel.
I don't know of a single worthwhile webmail client outside of Gmail. If you want to study the architecture of other webmail clients in PHP, then take a look at IMP (designed for PHP 4, and therefore ancient), Roundcube, or SquirrelMail. I am not responsible for any brain damage you suffer from reading the source.

Easiest option to send emails from PHP?

I am developing social service in Drupal. There is need to send notifications to registered users.
Which option would be the easiest to integrate Drupal with and to send notifications to users?
Amazon SES,
Google App Engine,
third party provider (like Sendgrid/PostageApp/CritSend)
SES/GAE are clear winners from business point of view.
This question is about which option would be the easiest to integrate with PHP code and which would provide least headache.
Please note that third party providers are not that easy to maintain, as they might drop emails without right MTA relay (unfortunately I experienced that problem with Sendgrid and another PHP service).
I would recommend you to use SwiftMailer, a PHP library that can easily send mails via any SMTP server, SendGrid will provide you with an SMTP server that you can use I believe.
in my opinion app engine(python). only a couple lines of code to create webservice to send out e-mail in python.
you just do simple post from cURL via PHP to sent email. easy as pie. Maybe later I will post a little snippet to achieve this :P.
These days, handling email in house is a royal PITA. I recommend mailchimp instead.
Just want to throw PostageApp's hat into the ring. We've got some documentation on integration with PHP and our API is one of the cleanest and easiest to use around.
We're also exploring an integration with Amazon SES to capitalize on their great prices (And the free option!) so you might be able to use both? Happy to answer questions should you have any.

PHP: Can we build a web application to send email from localhost, like ThunderBirds, OutLook.?

I don't know whether or not it's a good question :(
But my intention is to know if it is possible to to build an email client application like Thunderbird or OutLook . And can we able to configure/create a Web Application in PHP?
Please let me know your thoughts!
Thanks in advance!!!
I am not sure that I understand the question, but here a couple of notes :
if you want to create a web application, of course you can use PHP : it's been created for that task, and does it well
if you want to develop a webmail (ie, a web application to send/receive mail), it'll mean lots of work...
maybe taking a look at some existing webmails might be wiser ?
About that, you might be interested by my answer to the question How do you build a web based email client using PHP?
if you want to create a desktop application, this is possible too ;-)
take a look at PHP-GTK (GTK is the graphic toolkit used for Gnome and/or the Gimp, for instance), about that ; here are a couple links :
Desktop Application Development with PHP-GTK
Beginning PHP-GTK: Creating a Simple Interface
Beginning PHP-GTK: Signals
Uh, sure, but why would you do so? Thunderbird is free and open-source. You could just use that. Unless you've a compelling reason to develop an entirely new e-mail client, it's better not to reinvent the wheel.
Plenty of open-source webmail clients already exist, too. RoundCube is one of the prettiest.
PHP is usually used as a server-side scripting language to build web applications. It does have the functionality that you need to be able to send email messages from a properly configured server.
The mail should definitely be sent from the server not the local machine, but its perfectly ok to create a webmail system. Also you can retrieve incoming mails from your mail server. Actually there are webmail clients on the market that you can use. I personally like Squirrel Mail
I would recommend in your case that you look at using PHP as core backend and (x)html+javascript+ajax for frontend and front-to-backend communications.
Ajax is very good for dynamic pages where you do not want page reloads etc.
You could have a local smtp server to send the email, but most internet providers would not allow this. If the later is the case you need to use the internet providers smtp, alternatively allow the configuration of smtp within the user interface.
PHP has builtin classes to send mail which makes this process easy in either case.
Receiving mail and parsing them correctly is just a matter of understanding the correct protocols. (pop3 / exchange and so on).
I know this wasn't a straightforward answer, but I hope it gave at least some insight.

PHP Jabber Integration

I am wondering how to integrate jabber instead of using my AJAX polling script. I chanced upon the following: http://code.google.com/p/xmpphp/
It gives me access to a jabber server, but does not tell me how to exactly go about it. I mean for example
$payloads = $conn->processUntil(array('message', 'presence', 'end_stream', 'session_start'));
Are there a fixed set of commands that I can use? Is there some site which explains the jabber workflow in very simple terms?
Thank you very much for your time.
I've been wondering about technologies to play around with XMPP, been looking at:
Strophe
BOSH
Examples of this technology can be seen at:
drop.io
Chesspark
These two doc pages seem to be fairly readable:
Core
Instant Messaging and Presence
Also, you might already be heavily invested into xmpphp, but if not, you may want to take a look at Phurple. It gives you access to the libpurple library (the code-base for Pidgin) from PHP.
From the project page:
This libpurple PHP binding, which
defines a set of internal classes,
gives a possibility to use aol and icq
(oscar), yahoo, msn, jabber, irc and
much more protocols directly from PHP.
Write your own IM chat client in PHP,
as simply as PHP enables it.

Categories