Read Emails by PHP

Using IMAP you can read your inbox messages of your gmail account. Here I have shared code below.

 

<?php
            function readMail() {
                        $dns = “{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX”;
                        $email = “Your Mail”;
                        $password = “Password”;
                        $openmail = imap_open($dns,$email,$password ) or die(“Cannot Connect “.imap_last_error());
                        if ($openmail) {
                                    echo  “You have “.imap_num_msg($openmail). ” messages in your inbox\n\r”;
                                    for($i=1; $i <= 100; $i++) {
                                                $header = imap_header($openmail,$i);
                                                echo “<br>”;
                                                echo $header->Subject.” (“.$header->Date.”)”;
                                    }
                        echo “\n\r”;
                        $msg = imap_fetchbody($openmail,1,””,”FT_PEEK”);
                        /*
                        $msgBody = imap_fetchbody ($openmail, $i, “2.1”);
                        if ($msgBody == “”) {
                        $partno = “2.1”;
                        $ msgBody = imap_fetchbody ($openmail, $i, $partno);
                        }
                        $ msgBody = trim(substr(quoted_printable_decode($msgBody), 0, 200));
                        */
                        echo $msg;
                        imap_close($openmail);
                        }
                        else {
                        echo “False”;
                        }
            }
?>
Advertisements

IBM Worklight VS Phonegap

IBM Worklight vs PhoneGap –

Feature               
PhoneGap
IBM Worklight
Supports HTML5, CSS3, Java Script
Yes
Yes
3rd Party extensible
Yes
Yes
Development IDE/platform
No
Yes
WYSIWYG
No
Yes
Access native common controls tab bar, options menu, and more
No
Yes
Build
Cross-platform support
Yes
Yes
Web apps
Yes
Yes
Hybrid apps
Yes
Yes
Native apps
No
Yes
Desktop apps
No
Yes
Integrated shell coding
No
Yes
Deployment and Management
Application server
No
Yes
Mobile browser simulator
No
Yes
Authentication framework
No
Yes
Integrated backend connection
No
Yes
Encrypted offline storage
No
Yes
Runtime skinning
No
Yes
Unified push notifications
No
Yes
SMS delivery
No
Yes
Direct update
No
Yes
Version management
No
Yes
BI reports integration
No
yes