-4

I am designing online shopping (college project) site where after placing the order the system will send an email to user's email id. I have seen some tutorials but I am unable to figure out what is the problem.

I have edited php.ini of XAMPP as follows:

[mail function]
; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
SMTP =  smtp.gmail.com
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = skanungo2007@gmail.com

Now my code for sending the email:

<?php
$to='skanungo2007@ymail.com';
$message='hello';
mail($to, 'My Subject', $message);
?> 

Any solution for the problem??

  • 2
    possible duplicate of http://stackoverflow.com/a/18185233/3577946 – Indra Kumar S Dec 28 '14 at 11:43
  • How can someone help with diagnosing the "problem" if you don't actually specify what is going wrong? Are mails not being sent? Are you getting any errors in the code? Are you able to connect to gmail to use it as an SMTP server? Are you passing the correct credentials so that it verifies you and lets you use it? – Fluffeh Dec 28 '14 at 12:04
  • Sorry. Actually no mail is sent to the specified email id. @Fluffeh – Subhadeep Kanungo Dec 28 '14 at 12:24
  • @IndraKumarS: I have even tried the solution that is mentioned in the link you provided. But nothing is solving the problem – Subhadeep Kanungo Dec 28 '14 at 12:25

1 Answers1

0

You can use PHPMailer. More details on PHPMailer can be found here: http://phpmailer.worxware.com/ Actually if you are using xampp or wampp SMTP server is not installed by default. That is why email is unable to send.

Hahsim
  • 1
  • Can you please explain how can I install SMTM server? Did you mean that using PHP mailer will install SMTP server? Sorry if I have misinterpreted your statement. – Subhadeep Kanungo Dec 29 '14 at 17:53