0

I have a form which get email from user and then send an email to that and it is running fine on my local host but when I transferred my code to my server (Biz.nf) my PHP code for sending email does not work anymore. Any suggestion how should I get it running again?

$to = $_POST['EM']; // this is your Email address
$subject = "Recipt ";
$message = "The following is your receipt " .$FName. "\n This email was sent too prove that this functionality is working";
mail($to,$subject,$message);
Amir Torkashvand
  • 121
  • 1
  • 2
  • 10

1 Answers1

0

The majority of hosts handle email slightly differently and have different ideas of what a valid outgoing e-mail should contain.

The mail function actually has another paramater, 'headers'... see documentation

Its likely your host is stopping the mail for the lack of a particular header. Try some of the below headers to see what helps.

$to = $_POST['EM']; // this is your Email address
$subject = "Recipt ";
$message = "The following is your receipt " .$FName. "\n This email was sent too prove that this functionality is working";

$headers    = '';
$headers    = $headers."From: outgoing@emailaddress.com"."\r\n";
$headers    = $headers."Reply-To: replytomake@emailaddress.com"."\r\n";
$headers    = $headers."Content-Type: text/html; charset=ISO-8859-1\r\n";

mail($to,$subject,$message,$headers);

NOTE : The outgoing email address on some hosts, must be an existing one.

ZBerg
  • 78
  • 6