0

somebody help me for my php mail functionTQ

  <?php
  $to = 'myname@gmail.com';
  $sub = 'this is a test mail';
  $message ='this is a mail :)';
  $from = 'From: postmaster@localhost';
  $m = mail($to,$sub,$message,$from);
  if($m){
  echo'<b>ststus:</b> sent';    
  }else{
  echo'<b>ststus:</b> not sent';
  }
  ?>

Warning: mail(): SMTP server response: 553 We do not relay non-local mail, sorry. in E:\xampp\htdocs\mail\mail.php on line 6 status: not sent

zxq9
  • 13,020
  • 1
  • 43
  • 60
K55555
  • 7
  • 4

1 Answers1

1

By default, virtual servers like Xampp don't allow you to send mail from localhost because it's not an 'actual' server.

See this answer to make it happen: How to configure XAMPP to send mail from localhost?

paddotk
  • 1,359
  • 17
  • 31