0

I am Unable to send mails. i would like to know what i am doing wrong or how to connect to smtp.

Here is my code which i am using for sending emails.

Am i missing something

$to='pratik.purohit@steeplap.com';
$subject='Hey';
$body='
This is a test email
';
$headers='From: pratik.purohit@steeplap.com';
if(mail($to, $subject, $body, $headers)){
echo 'mail send '.$to;
}
else{
echo "mail not send";
}

1 Answers1

0

Just remove @ before mail () to see what's wrong in logs.

If you want to send emails using an external smtp server then use PHPMailler library.

Kerkouch
  • 1,286
  • 7
  • 14