1

I'm somewhat new to php and html coding and is wondering why I have this error. The mail is suppose to automatically send me information on what my customers bought; quantity and amount via email. However I'm constantly having this problem when I test run.

Warning: 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\process.php on line 39
    $myusername=$_SESSION['username'];
    $sql="SELECT email FROM member WHERE username='$myusername'";
    $result=mysql_query($sql);
    $from = $result;
    $subject = $myusername . "'s Purchases of ". $_SESSION['amount'] ." of XXXX.";
    $message = $_SESSION["payamount"] . "via CHEQUE/Cash on Collection.";
    $mail = mail("okay1@gmail.com",$subject,$message,"From: $from\n");
Cristofor
  • 2,077
  • 2
  • 15
  • 23
ysPhongE
  • 19
  • 3

2 Answers2

0

View this thread's answer to know how to configure your smtp server

Failed to connect to mailserver at "localhost" port 25

Community
  • 1
  • 1
Prashanth Kumar B
  • 566
  • 10
  • 25
0

you can use phpmailer to send emial https://github.com/PHPMailer/PHPMailer/blob/master/class.phpmailer.php

jediliang
  • 19
  • 2