PHP Mail using Gmail SMTP Tutorial 108

Alright, this was one of the queries I got a few days back. I finally got the time to pour some time on it.

So here is the tutorial for sending PHP Mail using Gmail as your SMTP engine.

First of you all, I’m going to pretend that you’re familiar with a few things:

  • PHP (you know, PHP: Hypertext Preprocessor). Its a lovely language for developing webpages. If you already knew that, then good. If not, you might want to read a good PHP Tutorial.
  • A local apache+PHP webserver running to test with. I use either XAMPP or WAMPServer, while on Windows Vista. Or install LAMP stack in Ubuntu.
  • Can edit your PHP.ini configuration file. (If you don’t know what I’m talking about, get really familiar with the above two.

K, here goes.

    1. If you haven’t done so already, get a PHP server running.


    1. Download PHP-Mailer (they also have other php software for easy form-to-email).


    1. Go to your C:\xampplite\htdocs folder (in XAMPP) or C:\wamp\www folder (in WAMP), and extract the PHP Mailer into it. I’ll call this folder Root from now on.


    1. Now go to Root\PHP-Mailer\examples\, and open up test_smtp_gmail_basic.php.


    1. Now you shall have to do some minor editing. Don’t worry, its majorly minor. Just change the Emails to your send and receiver, and type your password. Here’s what mine almost looks like. Almost. Thats not the password. … I think.


Open and edit test_smtp_gmail_basic.php

Open and edit test_smtp_gmail_basic.php

$mail->IsSMTP(); // telling the class to use SMTP

$mail->Host       = ""; // SMTP server

$mail->SMTPDebug  = 1;                     // enables SMTP debug information (for testing)

// 1 = errors and messages

// 2 = messages only

$mail->SMTPAuth   = true;                  // enable SMTP authentication

$mail->SMTPSecure = “ssl”;                 // sets the prefix to the servier

$mail->Host       = “”;      // sets GMAIL as the SMTP server

$mail->Port       = 465;                   // set the SMTP port for the GMAIL server

$mail->Username   = ““;  // GMAIL username

$mail->Password   = “topsecretpassword:D“;            // GMAIL password

$mail->SetFrom(‘‘, ‘Vishal Kumar’);

$mail->AddReplyTo(““,”Vishal Kumar”);

$mail->Subject    = “Hey, check out”;

$mail->AltBody    = “Hey, check out this new post on”; // optional, comment out and test


$address = ““;

$mail->AddAddress($address, "Vishal Kumar");


  1. Now, pressing save, you’ll be half done with this little tutorial. Ok, the actual step is you need to edit your PHP.ini file settings. You can find that C:\xampplite\php if you are into XAMPP. Here you need to open the PHP.ini file, then search for “openssl”. Go ahead and take that ‘;’ comment symbol from the start of the line. In WAMP, all you need is your mouse. Just click on the speedometer icon of WAMPServer in the taskbar. Go to PHP>PHP Extensions and click on php_openssl to turn it on
Enable the php_openssl.dll extension by taking off the ';'

Enable the php_openssl.dll extension by taking off the ‘;’ in XAMPP


Tick to enable php_openssl in WAMP

Tick to enable php_openssl in WAMP


    1. Restart your servers services. This should be fairly simple


  1. Go navigate to http://localhost/PHP-Mailer/examples/test_smtp_gmail_basic.php in your browser. And then check your Receivers Inbox. Hi!!!

Thats about it; thats how I managed to send emails using GMail’s SMTP engine to any mail, through PHP.

Note though, this tutorial is meant to be a specific reply to a certain query I got, but I figured more people would want to read this, so I posted it up.

If you have any doubts, or extensions, or any helpful suggestions, comment up. 🙂

108 thoughts on “PHP Mail using Gmail SMTP Tutorial

  1. Reply saliya Aug 3,2009 6:03 pm

    Hey dude thx very very much this post really helpedme alooooooootttttttttttt 🙂 u r the best

    • Reply Venki Feb 8,2011 2:23 pm

      Hi, its nice to see your blog. can any one enter IIMB to see such an exiting place??

    • Reply yogesh May 1,2012 10:53 am

      Hey Dear..How to process First of to last step sen email in PHP and how to set configure php,ini file…….
      pls help me now.pls……

  2. Reply manu Aug 5,2009 7:05 am

    $mail = new PHPMailer();
    $mail->Host = "ssl://";
    $mail->SMTPSecure = "ssl";
    $mail->IsSMTP(); // send via SMTP
    IsSMTP(); // send via SMTP
    $mail->SMTPAuth = true; // turn on SMTP authentication
    $mail->Username = ""; // SMTP username
    $mail->Password = "mygmailaccountpassword"; // SMTP password
    $webmaster_email = ""; //Reply to this email ID
    $email=""; // Recipients email ID
    $name="name"; // Recipient's name
    $mail->From = $webmaster_email;
    $mail->FromName = "Webmaster";
    $mail->WordWrap = 50; // set word wrap
    $mail->AddAttachment("/var/tmp/file.tar.gz"); // attachment
    $mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // attachment
    $mail->IsHTML(true); // send as HTML
    $mail->Subject = "This is the subject";
    $mail->Body = "Hi,
    This is the HTML BODY "; //HTML Body
    $mail->AltBody = "This is the body when user views in plain text format"; //Text Body
    echo "Mailer Error: " . $mail->ErrorInfo;
    echo "Message has been sent";

    am getting follwing errors…..

    Deprecated: Function eregi() is deprecated in D:wampwwwffphpMailerclass.phpmailer.php on line 594

    Warning: fsockopen() [function.fsockopen]: SSL operation failed with code 1. OpenSSL Error messages: error:140770FC:SSL routines:func(119):reason(252) in D:wampwwwffphpMailerclass.smtp.php on line 125

    Warning: fsockopen() [function.fsockopen]: Failed to enable crypto in D:wampwwwffphpMailerclass.smtp.php on line 125

    Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://localhost:25 (Unknown error) in D:wampwwwffphpMailerclass.smtp.php on line 125
    Mailer Error: SMTP Error: Could not connect to SMTP host.

    thanks in advances….

    • Reply waseem ahmed Dec 23,2010 12:34 pm

      thanks for ur turtorial. I have one question for u vishal.can you please tell me how to send twit to twitter using php

  3. Reply Piyush Aug 15,2009 4:37 pm

    hello vishal kumar,

    i m trying to install a prog. in my system but after installation when run its index.php then it shows login screen and when i type user name and password which i allready created during installation process it shows wrong user name /password message. i don't know where i m wrong but i think i m doing wrong when third step of installation ask for SMTP server IP address then user name and password.

    i m using google as a smtp server but still i don't understand what is the IP adress of SMTP server and how can i find IP adress of SMTP Server. will u please help me to install this software in my system as wel as my web server. if u wish i can send u prog. what i m installing in my system. my mail ID is

    • Reply itsvishal Sep 6,2009 5:27 pm

      Hey, what software are you using? It might help if you put the links for it.

      And when specifying the STMP address you don't need to put in the IP Address anywhere. Its the thats required. The DNS Servers will send the request to the correct IP Address.

    • Reply pinal jamariya Jul 31,2012 8:21 am

      i m using google as a smtp server but still i don’t understand but any world meanig to ask general

  4. Reply manoj Feb 5,2010 8:21 am

    hi vishal'
    Your tutotial helped me a lot to send mail using smtp authentication in php, am using Xampp1.7.1, while trying to send error i get the following error.
    Error : authentication failure [SMTP: Invalid response code received from server (code: 535, response: authentication failed (#5.7.1))]

    but when tried to send mail using outlook, it works perfectly, please help me

  5. Reply Yash Mistrey Feb 13,2010 12:50 pm

    Dear Vishal!

    I am using google apps. for email.

    actually i am very confusing on web form processing.

    I couldn't able to send email from my website form to my email.

    my ISP saying to use smtp in form they saying


    We have disabled anonymous user to send mail, so you have to send mail through SMTP authentication and smtp details are given below:-
    Host:- mail.your_domain_name
    User name:- XXX@your_domain_name
    Password:- corresponding password
    Port :-25 or 26

    But is didn't work, after they saying that it is bcz of your are using google apps.

    Please reply me solution with any example.

    I read your tutorial , but, i didn't get it. right

    i want to send email from this way but this tutorial is not well explained. can you explain with any example .

    I don't know php so details.

    Please Vishal!
    I am waiting your reply.

  6. Reply giri Feb 23,2010 3:11 pm

    thanks dude your tutorial is good.

  7. Reply adunkey Feb 27,2010 8:04 pm

    i get this error:

    Parse error: parse error in C:wampwwwPHPMailer_v5.1examplestest_smtp_gmail_basic.php on line 28
    do you change your php.ini at all??/

    • Reply Vishal Kumar Mar 11,2010 3:55 am

      Yes, the php.ini needs to be edit. Check the tutorial again.
      For the parse error, you might have accidentally deleted a few characters or misspelled a word.

      • Reply Rajeev Jul 26,2012 1:48 pm

        your tutorial is gud but i want to build a e-mail server ….project like yahoo or gmail e-mail system..plz if u can help me then send me that piece of code(php)….example inbox,sent .drft.etc….so if u can … me…
        hope…u solved my problem..

  8. Reply sandeep kumar Mar 2,2010 10:45 am

    thanks buddy, thats why Indians are better than …………..

  9. Reply rootkit87 Mar 7,2010 9:42 am

    Thx man….
    this was the best tutorial for sending mail…

    it worked like a charm 😉

    u r the best 🙂 🙂

  10. Reply Shil Mar 10,2010 10:19 pm

    Hi Vishal,
    Great Tutorial, I have configured everything using your tutorial and the mail gets sent to my gmail account. Just wanted to ask you something, I have created an email form where I want to click on the Send Button and this should send an email to my gmail account, how do I do this? Will be waiting for your reply. Many thanks

    • Reply Vishal Kumar Mar 11,2010 3:53 am

      In your email Form, you would be making use of the <form> tag and assigning it an action (the PHP mail sending page), and a method (either GET-send the data in the URL address, or POST-send it in the request itself, so it doesn't appear in the URL).

      So you'll have <form action="sendmail.php" method="post">…

      Then in your sendmail.php, you need to receive the variables.
      Access the form elements in the previous page with '$_POST['name']'. So instead of the strings in the demo email sending above, you would use the POST variables.

  11. Reply ANIRUDH TOMER Mar 12,2010 1:26 am

    what you have done is good vishal but I would like to mention that u are no where using standard "mail()" function of PHP which dosen't work unless
    1> u send mail from localhost to localhost
    2> u have a registered domain on the webspace

    anyways nice tutorial…great job

  12. Reply dax Mar 18,2010 6:36 am

    Hi Vishal
    I have configured everything using your tutorial and the mail net gets sent to my gmail account.
    actually it is not shown any error and not send the mail

    • Reply Vishal Kumar May 10,2010 1:49 pm

      Where have you hosted this? Have you started from fresh? You can also enable error messages by setting STMPDebug to 1.

      Also check out that your PHP is working by enabling error messages in php.ini (search for error_reporting ), and making sure theres a line like error_reporting = E_ALL

  13. Reply Zaka Mar 21,2010 8:55 am

    it not working . wht to do of include("class.phpmailer.php");include("class.smtp.php") ?

  14. Reply Wendy Mar 27,2010 3:13 am

    Thank you for your useful information 🙂

  15. Reply SkyJumper Apr 20,2010 11:33 pm

    do i need to also make changes at the php.ini at the part below?
    [mail function]
    ; For Win32 only.
    ;SMTP = localhost
    ;smtp_port = 25

    ; For Win32 only.
    ;sendmail_from = root@localhost

  16. Reply sourabh May 20,2010 2:09 am

    Hi vishal , i have followed instructions above but when i run test_smtp_gmail_basic.php in browser it doesn't display anything and email is not delivered. i am using wampserver 2.0 please help me out.

    • Reply itsvishal May 20,2010 6:46 am

      Are you sure you followed instructions to the letter?
      First check that normal php pages are being displayed (i.e. wamp is running as it should). Create a test.php page in your www folder, and put in <?php echo "hi"; ?>
      Then open the page by going to your http://localhost/test.php. You should see a "hi".
      If you don't, check click on the wampserver logo and select Start All Services.
      If you have started the services and you were just thinking that yada yada yada I've already done all of that, please make sure that you've edited the php.ini page.
      If even that doesn't work, try using XAMPP, and try with the same instructions.

  17. Reply swapnesh Dec 15,2010 8:56 pm

    i tried all your instructions but still getting following error while creating new tickets.
    Warning: mail() [function.mail]: SMTP server response: 501 5.5.4 Invalid Address in C:Inetpubwwwrootosticket_1.6.0uploadincludepearMailmail.php on line 128

  18. Reply hus Jan 3,2011 4:38 pm

    got this error. can u help me?

    SMTP -> ERROR: Failed to connect to server: Unable to find the socket transport "ssl" – did you forget to enable it when you configured PHP? (104113184)
    SMTP Error: Could not connect to SMTP host. Mailer Error: SMTP Error: Could not connect to SMTP host.

    • Reply MachineniVenkatesh Apr 6,2012 3:17 pm

      uncomment (remove ;)the "extension=php_openssl.dll" if it is available in php.ini file .fi it is not there in php.ini file add "extension=php_openssl.dll" in Dynamic extensions in php.ini file

  19. Reply Furqan Feb 14,2011 11:00 am

    I found this error
    SMTP Error: Could not connect to SMTP host. Message was not sent.Mailer error: SMTP Error: Could not connect to SMTP host.

  20. Reply Farooq Feb 22,2011 1:04 am

    very good tutorial vishal..
    i had some problems in php versions initially but got over 'em..
    Great work!!

  21. Reply kishan illur Mar 19,2011 8:38 pm

    Hi Vishal, can i use this code to send an email to my gmail account from the website i have host…? if yes, could u tel me the way to do it…?

  22. Reply -me Apr 3,2011 1:46 am

    Thanks buddy. It has helped me and gifted me a smiley face.
    🙂 This one is for you.

    Thanks again

  23. Reply Shashwat May 27,2011 3:24 am

    I got the following error:

    SMTP -> ERROR: Failed to connect to server: Unable to find the socket transport "ssl" – did you forget to enable it when you configured PHP? (24439416)
    SMTP Error: Could not connect to SMTP host. Mailer Error: SMTP Error: Could not connect to SMTP host.

    • Reply machineni venkatesh Apr 6,2012 3:23 pm

      uncomment(remove 😉 "extension=php_openssl.dll" in php.ini file .If it is not available in php.ini file add extension=php_openssl.dll

  24. Reply ashok Jun 1,2011 12:52 am

    thanks boss

  25. Reply Hendra Jun 26,2011 12:26 pm

    hii Vishal,
    i have followed instructions above but when i run test_smtp_gmail_basic.php,
    but i get this error :
    "SMTP -> ERROR: Failed to connect to server: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (10060)
    SMTP Error: Could not connect to SMTP host. Mailer Error: SMTP Error: Could not connect to SMTP host."

    why this happen?can you help me,please….

  26. Reply dila Jul 2,2011 1:15 pm

    thank you so much for your effort by making this tutorial..
    i have been looking for this solution almost 3 weeks..
    now i can finish my final year project..
    thanks again..

  27. Reply amit dubey Jul 21,2011 10:12 pm

    thanks dear,you really wrote all these steps very clearly,
    i again really-2 thankful to you
    -amit dubey
    New Delhi,India

  28. Reply Sony.k Jul 24,2011 10:37 pm

    $to = "";
    $subject = "Test mail";
    $message = "Hello! This is a simple email message.";
    $from = "";
    $headers = "From:" . $from;
    echo "Mail Sent.";

    In php.ini

    [mail function]
    ; For Win32 only.
    SMTP =
    smtp_port = 465

    auth_username = sony
    auth_password = asdsa

    pop3_server =
    pop3_username = sonyi
    pop3_password = asdsa

    Still its not working . Please mail me at with correct solution.

  29. Reply todo Aug 19,2011 12:05 am

    hello Vishal!

    I am using google apps. for email. and i am try to send mail by using phpmailer.
    my php code has work good with my gmail account like
    but when i am try to send mail with my google apps email like, it's not worked.

    so please tell me which extra setting i have to done to send mail.?


  30. Reply Ashish Sep 3,2011 8:18 pm

    Thank you so much..I am very happy… I had googled for total 20 hours "how to send main using php script?"..
    But all in vain.. At last your post helped me to get rid of my problem…
    For the time being its working very fine.. 😀 😀 😀

  31. Reply Ashish Sep 3,2011 8:20 pm

    Thank you so much..I am very happy… I had googled for total 20 hours "how to send main using php script?"..

  32. Reply alisha Sep 15,2011 6:04 pm

    Do i need to edit anything on php.ini file and php extension php_open_ssl but nothing is being displayed what we need to write in include_path in php.ini file i don't know what we need to edit in php.ini. i have followed all your instructions but blank page is being displayed when i open http://localhost/phpmailer/PHPMailer_5.2.0/examples/test_smtp_gmail_basic.php page.

  33. Reply Wut Yee Tun Oct 5,2011 10:58 am

    thanks u so much buddy your tutorial is so Cool. 🙂

  34. Reply Ali Nov 28,2011 7:00 am

    it worked for me thanks sooooooo much i was having probs with it for a long time… thanks again

  35. Reply Sinduja Dec 2,2011 4:49 pm

    I need to have contact form on facebook page. The user should be allowed to fill the form and submit it. The submit function should get the inputs of user and mail it to my gmail id..

    For this , can i use the same code mentioned above….

  36. Reply Amars Dec 29,2011 4:59 pm

    I'm new to PHP, i can't find this information for past 2 months. This info is very useful and very easily to understand….. Lots of thanks to Vishal….

  37. Reply Michael Jan 7,2012 1:01 am

    This is the real link to the php example folder

  38. Reply Astika Jan 10,2012 2:42 pm

    Now go to RootPHP-Mailerexamples, and open up test_smtp_gmail_basic.php.
    I could not found PHP-Mailerexamples in downloaded file.plz help

  39. Reply Pragathi Jan 15,2012 9:51 am

    It's Working…………………. Thanks bro………u r the best………………..

  40. Reply GUNA SHEKAR Feb 26,2012 9:46 pm

    am guna shekar . there is no file called test_smtp_gmail_basic.php in that PHP den how come the above people just lie that this tutorial worked well for them….

  41. Reply anitha Mar 22,2012 6:08 pm

    Hi Vishal,

    i m getting following error on my local machine.

    SMTP -> ERROR: MAIL not accepted from server: SMTP -> ERROR: RCPT not accepted from server:

  42. Reply arar Mar 25,2012 12:23 pm

    cannot find: RootPHP-Mailerexamples

  43. Reply vks Apr 24,2012 10:45 am

    thx dude, its realy great that's working perfectly thnx once again

  44. Reply Nuar Haruha Apr 24,2012 8:42 pm

    Good write up Vishal.
    if u intent to send any email to google or yahoo or any major email provider you'll probably need to append a 'return path' (bounce mail address) on the headers <code></code>, otherwise your email might be consider as spam and end up in the spambox. not where it should be. Just my 2cents

  45. Reply yogesh Apr 30,2012 11:45 am

    Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:wampwwwmailmail.php on line 27
    Cannot Send Email

    Pls Send me Properly worked file plsssssss

  46. Pingback: Vishal Kumar – Return of the Blog

  47. Reply friends.Shail Jul 6,2012 7:04 pm


    You can find out more on the same topic on below given URL in details , as we had faced the same issue with & without Gmail SMTP and updated scripts are working perfectly fine with same .


  48. Reply Iqbal Khan Jul 7,2012 10:23 am

    Thanks a lot Vishal Kumar! Your tutorial is really a good one. But please tell me whether it’s the only way of sending mails from localhost in PHP, i.e., when we don’t want upload our site and want to continue testing it on localhost? You know that the mail( ) function is already there in PHP but when I use it, I get this error message:

    “Warning: mail() [function.mail]: Failed to connect to mailserver at “localhost” port 25, verify your “SMTP” and “smtp_port” setting in php.ini or use ini_set() in C:\wamp\www\CompleteSite\Copy of MailTry.php on line 9″

    When I use ini_set( ) function for setting smtp then I get this error message:

    Warning: mail() [function.mail]: SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. y2sm10787087wix.7 in C:\wamp\www\CompleteSite\Copy of MailTry.php on line 9.

    Please do reply.
    Thanks in advance,
    Iqbal Khan

  49. Reply andrew Jul 12,2012 6:46 am

    Hello ,
    I am getting the error,How to resolve

    Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay for in C:\Inetpub\wwwroot\m\sendmail.php on line 7

  50. Reply suma Jul 15,2012 7:18 pm

    Warning: mail() [function.mail]: SMTP server response: 550 5.1.8 invalid/host-not-in-DNS return address not allowed
    this has occured !!
    am not getting it!!
    please help me!!
    please mail your answer!!

  51. Reply sam Jul 20,2012 6:56 am

    helped me quite a lot

  52. Reply Shahnawaz Jul 28,2012 10:54 am

    I want to deliver sms or email to register user on date of expiry.Can u help how this can be done.

  53. Reply Rafiq Aug 3,2012 10:54 am

    how to add editor in the message and send html email ?

  54. Reply vishal Aug 8,2012 3:09 pm

    You are excellent and this blog is excellent too. I think you should start your tutorial site

  55. Reply Mike Aug 12,2012 6:50 am

    Vishal Kumar;

    You did this tutorial I don’t know how long ago. But today August 11, 2012, you help me to make progress on my project and I am grateful to you. Thanks a lot,


  56. Reply Lei Vice Aug 14,2012 6:48 am

    Power to this post!! Thanks a lot.. it helped me!!

  57. Reply Jim Aug 20,2012 11:02 am

    Hi – anyone care to help me write a script for sending emails from “Contact Submission Form” of a website ?

    The webhost where i’m hosting does NOT provide PHP sendmail. The support team have suggested in using “Gmail SMTP Service” for sending emails.

    The content of the script should include the following :

    Use SMTP Server for E-mail: Yes
    SMTP Server Address: ssl://
    SMTP Server Port: 465
    Authentication Method: PLAIN
    SMTP username: [Your Gmail or Google Apps E-mail address]
    SMTP password: [Your E-mail Account password]

    The body of the script should be contained in the following structure;

    Thanks in advance.

  58. Reply Bhawna Aug 26,2012 7:23 pm

    Hello Sir,
    I’m begineer in PHP.So,i don’t understand very well.your tutorial.But when i follow your tutorial by installing to phpmailer0.9 then it was not showing test_smtp_gmail_basic.php in phpmailer folder which i unziped.But i try from my side(any example) then i failed. So,could you plz help me ….why test_smtp_gmail_basic.php file was not found …I’m using wamp 2.2

  59. Reply Jai Singh Sep 15,2012 4:20 pm

    Hi Every 1,

    I need your help i m making a new application on php for mass mailing though smtp.single smtp is working fine but i want to use multiple smtp to send email. when i use this my mail is stop to sending the file can you please tell me what code i use for sending mail though multiple smtp for mass mail plz i m waiting for your reply bro

  60. Reply unknown Sep 19,2012 5:10 pm

    hey there is no examples folder in php mailler.PLZ HELP

  61. Reply suresh Oct 7,2012 5:47 pm

    dear i need send email in php SMTP gmail.
    please send me program files..


  62. Reply Raul Oct 16,2012 4:09 pm

    Simpliest solution:

    SMTP4PHP is a collection of PHP classes, dedicated for composing and sending multipart/mixed email messages quickly and easily, with or without embedded images and/or attachments.

    from = new User(SENDER_NAME, SENDER_EMAIL);
    $e->to = new User("Receiver's name", '');
    $e->subject = 'SMTP4PHP Test mail';
    // EXAMPLE: add inline image example
    $e->htmlMessage = 'This is a HTML message!addImage('./image.jpg').'" border="0">';
    $e->txtMessage = 'This is a TEXT message!';
    // EXAMPLE: add attachment example

    /* NOTE: ALL emails are sent through the same connection, speeding up transmission. */
    try { $smtp->send($e); /* OR $smtp->send($e,$e1,$e2);*/ }
    catch(Exception $e) { }

  63. Reply onkar Oct 18,2012 7:52 am


    I found this when trying it on my local machine, can you suggest me how to solve it.

    Failed to connect to [SMTP: Invalid response code received from server (code: -1, response: )]


  64. Reply J. Oct 25,2012 1:16 pm

    why there is no test_smtp_gmail_basic.php in PHP-Mailer folder?

  65. Reply BIJAYINI Oct 31,2012 12:28 pm

    i have completed 1st step.but i acan’t get php.ini.plz help me.

  66. Reply BIJAYINI Oct 31,2012 12:43 pm

    Sorry i get php.inn but i can’t get openssl.dll.plz help me

  67. Reply web development company Nov 16,2012 12:26 pm

    I know it was always looking for trouble if you try to use your free Gmail acount as the SMTP server for your web application. I used for tests while writing this tutorial my Google Apps account. The best choice is an alternative SMTP service, Sendgrid is cool and offers a free account as well (enough for smaller applications)

  68. Reply vishal Nov 19,2012 11:09 am

    selling for 1.45 L, if interested let know

  69. Reply ram Nov 24,2012 7:22 am

    Thanks for the code. I used it and it worked but I’m getting an error along with “message sent” as….
    Invalid address: ‘, ‘Message sent!

    this is the error i’m gettin. please help. and also tell me how to add cc, bcc in the same code…thank you

  70. Reply sameeksha Nov 28,2012 10:49 am

    Your site is tooo good…i was trying from 1 month but i failed.but your site helped me to resolve the problem,..thanx budddy…………

  71. Pingback: 【未解决】给wordpress添加smtp | 在路上

  72. Reply prakash Dec 13,2012 5:56 am

    i want the php code for if click the send button to open a gmail compose mail (via-plugins).If it’s possible pls send the code vishal

  73. Reply Saish Neogi Dec 27,2012 10:56 am

    I followed the steps exactly the way you told. Just the thing is that m getting message body empty error.I could’nt understand which message body it relates to.
    Please help.
    waiting for reply

  74. Reply Nikunj Jan 12,2013 10:12 am

    hello vishal,
    i follow all the step according you, but when i run test_smpt_gmai_basic.php file they throw error
    please help me

    SMTP -> ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed: No such host is known. (0)
    SMTP Error: Could not connect to SMTP host. Mailer Error: SMTP Error: Could not connect to SMTP host.

  75. Reply Brits Jan 12,2013 8:17 pm

    Invalid address: user@gmail.comInvalid address: user@gmail.comInvalid address: user@yahoo.comMailer Error: You must provide at least one recipient email address.

    I tried PHPmailer with WAMP it worked fine on my local laptop, when i uploaded it to the server I am getting the above error.

    What could be the problem? I am using 000webhost free hosting service with
    Apache ver. 2.2.19 (Unix)
    PHP version 5.2.*
    MySQL ver. 5.1

    Thanks in advance!!

  76. Reply avtar Jan 24,2013 1:38 pm

    Thanks a pile buddy !
    you made my day.

  77. Reply bhagyashri Jan 30,2013 4:49 am

    thank you for providing correct does work…too good…..

  78. Reply kalyan Feb 4,2013 8:20 pm

    Hi Vishal,
    can this code be used in codeigniter for sending an email verification to every user who ever registers it with their email id.with declaring a variable and passing it via post method for processing and sending the mail back.Please share any codeigniter code if you have worked with ….may be basic stuff.just to understand the working.

    thanks in advance

  79. Reply sanu Feb 21,2013 4:19 pm

    Thanx a lot..your blog was really helpful!! 🙂

  80. Reply jai Feb 28,2013 11:33 am

    sir i download PHP-mailer and extract it also but i didn’t get test_smtp_basic_gmail.php
    what can i do sir pls help me

  81. Reply gareeb Mar 4,2013 2:20 am

    Is it possible to attach any file along with this through the php script? Can u please explain about it?
    And is possible to mail directly from my pc without using gmail server?


  82. Reply Amol Mar 23,2016 11:22 am

    Hi Vishal,

    I am beginner in php,and i want to send mail using php.

    Following code I am using but but it shows message “Sending Failed”.

    Please help me to resolve this. I will be very thankful to you.

  83. Reply me Mar 31,2017 8:24 am

    Invalid address: SMTP -> ERROR: Failed to connect to server: (0)
    The following From address failed: root@localhost : Called Mail() without being connected

    what i do for this error

Leave a Reply