Thursday, 27 June 2013

Send email from localhost/WAMP Server using sendmail


The new WAMP Server’s PHP and stand-alone PHP v5.3+, are now NOT available with some of the extensions required to implement the previous solution [PHPMailer] (there is a workaround to install the missing extension(s), described in the linked article). So an alternate and much less efficient (slower, but negligible low-speed for development platform (WAMP/localhost)) solution can be implemented, as below:

Solution:
This solution requires sendmail.exe (a Command Line Interface (CLI) executable which accepts email from PHP, connects to an SMTP server and sends email). You will not require to use it by command, don’t bother about it :-) Download the sendmail.zip and follow these steps:
  • Create a folder named “sendmail” in “C:\wamp\”.
  • Extract these 4 files in “sendmail” folder: “sendmail.exe”, “libeay32.dll”, “ssleay32.dll” and “sendmail.ini”.
  • Open the “sendmail.ini” file and configure it as following
    • smtp_server=smtp.gmail.com
    • smtp_port=465
    • smtp_ssl=ssl
    • default_domain=localhost
    • error_logfile=error.log
    • debug_logfile=debug.log
    • auth_username=[your_gmail_account_username]@gmail.com
    • auth_password=[your_gmail_account_password]
    • pop3_server=
    • pop3_username=
    • pop3_password=
    • force_sender=
    • force_recipient=
    • hostname=localhost
    You do not need to specify any value for these properties: pop3_server, pop3_username, pop3_password, force_sender, force_recipient. The error_logfile and debug_logfile settings should be kept blank if you have already sent successful email(s) otherwise size of this file will keep increasing. Enable these log file settings if you don’t get able to send email using sendmail.
  • Enable IMAP Access in your GMail’s Settings -> Forwarding and POP/IMAP -> IMAP Access:
  • Enable “ssl_module” module in Apache server:
  • Enable “php_openssl” and “php_sockets” extensions for PHP compiler:
  • Open php.ini from “C:\wamp\bin\apache\Apache2.2.17\bin” and configure it as following (The php.ini at “C:\wamp\bin\php\php5.3.x” would not work) (You just need to configure the last line in the following code, prefix semicolon (;) against other lines):
    [mail function]
    ; For Win32 only.
    ; http://php.net/smtp
    ;SMTP =
    ; http://php.net/smtp-port
    ;smtp_port = 25
    
    ; For Win32 only.
    ; http://php.net/sendmail-from
    ;sendmail_from = you@domain.com
    ; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
    ; http://php.net/sendmail-path
    sendmail_path = "C:\wamp\sendmail\sendmail.exe -t -i"
  • Restart WAMP Server.
  • Create a PHP file and write the following code in it:
    <?php
    $to       = 'recipient@yahoo.com';
    $subject  = 'Testing sendmail.exe';
    $message  = 'Hi, you just received an email using sendmail!';
    $headers  = 'From: sender@gmail.com' . "\r\n" .
                'Reply-To: sender@gmail.com' . "\r\n" .
                'MIME-Version: 1.0' . "\r\n" .
                'Content-type: text/html; charset=iso-8859-1' . "\r\n" .
                'X-Mailer: PHP/' . phpversion();
    if(mail($to, $subject, $message, $headers))
        echo "Email sent";
    else
        echo "Email sending failed";
    ?>
  • Make appropriate changes in $to and $headers variables to set recipient, sender and reply-to address. Save it as “send-mail.php”. (You can save it anywhere or inside any sub-folder in “C:\wamp\www”.)
  • Open this file in browser, it MUST work now :-)

Monday, 21 May 2012

Ship

http://code.google.com/p/php-parcel-tracker/source/browse/carriers/usps.class.php?r=ecd3a1e9dfed7a2555b39178bf6bfd197040933e


http://forum.opencart.com/viewtopic.php?f=119&t=35867


http://lamp-dev.com/usps-web-tools-guide/205


http://bytes.com/topic/php/answers/905483-usps-tracking-api

Thursday, 9 February 2012

Simple-LinkedIn PHP

http://code.google.com/p/simple-linkedinphp/

LinkedIn JavaScript API Developer Console

http://developer.linkedinlabs.com/jsapi-console/#examples/member/badge.html&{%22framework%22:%22platform.linkedin.com/in.js%22,%22frameworkurl%22:%22%22,%22apikey%22:%22%22,%22apioptions%22:%22onLoad:%20onLinkedInLoad\n%22,%22sessionbuttons%22:true,%22async%22:false}

Tuesday, 7 February 2012

Linkedin

https://developer.linkedin.com/forum/login-button-script-firstname-and-lastname-blocking-my-website

Thursday, 2 February 2012

How to configure multi store in OpenCart?



Many of you might use opencart for online store development. Opencart can also be used for multi store with single admin; you can manage both stores with same admin.
I am using wamp so first I will tell you to configure multi stores with opencart on wamp.
I installed wamp in D drive and opencart directory path is D:\wamp\www\opencart. Main store url is http://localhost/opencart and I am going to make new store by the name of store.
  1. There is a file httpd.conf in wamp\bin\apache\Apache2.2.21\conf\. Open it and write following lines to create Alias for opencart new store.
Alias \store “D:/wamp/www/opencart/”
Note: Alias is pointing to same directory that is for my main store. It will be same for any other store too if you want to create.
Now save file and restart Apache services.
  1. Now you have to change OpenCart configurations. Login to opencart admin then go System>Settings, create new store. You can give any name to the store and give Url http://localhost/store/.
  2. Now save your settings and you can access your both stores by http://locahost/opencart/ and http://localhsot/store/ urls.
You can create multi store on xamp too; just you need to make Alias in D:\xampp\apache\conf\httpd.conf file
Note: D is the drive where xamp is installed; your location might be different.
Have fun with multi store on opencart.