August 3, 2012 4:23 am

Send Email with SMTP and PHP Mailer

In this tutorial we have a simple script which send email through SMTP (Send Mail Transfer protocol) with PHP Mailer. We need phpmailer library and bellow given code.

PHP Code

Simple PHP file

Author Huzoor Bux

I am Huzoor Bux from Karachi (Pakistan). I have been working as a PHP Developer from last 5+ years, and its my passion to learn new things and implement them as a practice. Basically I am a PHP developer but now days exploring more in HTML5, CSS and jQuery libraries.


Tutorial Categories:
  • daman sony

    This is not working!!
    Getting This error comes
    Fatal error: Class ‘SMTP’ not found in C:wampwwwFBSTOREphpmailerPHPclass.phpmailer.php on line 1147

    • huzoorbux

      Download the code and use it as it is just edit index.php file.

      • tẻtretre

        lódfdsafds

        • tẻtretre

          ewrewrew

      • রাজিউল ইসলাম

        Its not working 🙁

    • tẻtretre

      yuytuytuyt tyretre re erterter ert ẻ432423432 32423423423423 423 423423

      • tẻtretre

        432423432432423

        • tẻtretre

          3432432

          • tẻtretre

            432423432

          • tẻtretre

            ewqewq

          • tẻtretre

            ewqewq rêwrew

      • tẻtretre

        ewqewqe

    • tẻtretre

      qưeerew

      • tẻtretre

        rưerewrew

      • tẻtretre

        rưerew

  • kuldeep sonawane

    hi, nice tutorials. if it is possible write a tutorial on send MSG to phone. Thanks by the way good job!

  • Ghulam Ali

    amazing sir jee. i tried all others script but your script is working absoulutly amazing withour getting any error. thanx

  • Alok

    anyone can provide editing file of index.php file……because my code i notn working………my email id is alok80a@gmail.com…(without username and password)

  • Hello sir I wan to know tht it may possibile to receive emails from smtp which email like mymail@mydomain.com that is created from domain ?

  • Gautam

    i have download the code but it gives following error :

    SMTP Error: Could not authenticate.1

    how could i solve it

    is there any changes needed is “php.ini” file

  • dipjoy datta

    I am using same code but getting error like : SMTP Error: Could not connect to SMTP host. 1

    • that means your host is not valid post your host below.

  • freesonglyrics

    i am getting the this error
    SMTP Error: Could not authenticate.
    1
    i am using windows server where windows 2012 is installed. What will be the solution to get rid of this problem.

    thanks

    • Invalid login details you are sending please check your login details.

  • রাজিউল ইসলাম

    Its not working ,Please update a new one