Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Mail

Mail sending failed

the mail() function

Moderators: macek, egami, gesf

Mail sending failed

Postby sunnydesuja » Tue Apr 03, 2012 9:30 pm

Hi Guys,

I am new to php and i am using this code to send mail but it is giving error mail sending failed...

Please help me on this
Code: Select all



$mail_body="Details \n";
$mail_body .="Name : ";
$mail_body .="$name \n";

$mail_body .="Contact Number: ";
$mail_body .="$contact \n";

$mail_body .="Best Time to reach : ";
$mail_body .="$time \n";

$mail_body .="State : ";
$mail_body .="$state \n";

$mail_body .="ZipCode : ";
$mail_body .="$zipcode \n";

$mail_body .="Email Address : ";
$mail_body .="$emailsubscribe \n";

$mail_body .="Medications that you take regularly: ";
$mail_body .="$medication \n";

$mail_body .="Name and Dosage of the Medications: ";
$mail_body .="$dosage \n";

$mail_body .="Do you take medication for Sexual Health: ";
$mail_body .="$radiobutton1 \n";

$mail_body .="What medication do you prefer for sexual health: ";
$mail_body .="$radiobutton2 \n";

$mail_body .="Where do you purchase your medication from: ";
$mail_body .="$radiobutton3 \n";

$headers="Mail From :". " ".  $emailsubscribe;

if(mail("",'RX-CarePharma Inquiry form filled',$mail_body,$headers))
   echo "<script>window.location.href='rx-thanks.html';</script>";
   echo "<script>alert(\"Mail sending failed\"); window.location.href='RX-care.html'; </script>";
New php-forum User
New php-forum User
Posts: 1
Joined: Tue Apr 03, 2012 9:13 pm

Re: Mail sending failed

Postby LadyKYra » Fri Apr 06, 2012 3:16 am

Hello sunny, I dont hve much time to read ur codes. You can check this out, it is an example from w3school
Idk if this will clear out things, but it can help. xD
$to = ",";
$subject = "HTML email";

$message = "
<title>HTML email</title>
<p>This email contains HTML Tags!</p>

// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";

// More headers
$headers .= 'From: <>' . "\r\n";
$headers .= 'Cc:' . "\r\n";

New php-forum User
New php-forum User
Posts: 9
Joined: Tue Feb 07, 2012 9:36 pm

Return to PHP coding => Mail

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.