having much problem in email.
i tried everything..but dont know whats hapening im getting simple plain text email
while im sending the html input

{
$from_name= ADMIN_NAME;
$from_email=ADMIN_EMAIL;
$subject="Simple html email";
$message = '<h1>Hello, World!</h1> </br>'.$_POST['msg'];

$headers = "From: $from_name <$from_email>\r\n";
$headers .= "Reply-To: $from_name <$from_email>\r\n";
$headers .= "Return-Path: $from_name <$from_email>\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

$query="SELECT email From abc WHERE visible=1";
		$result=mysql_query($query) or mysql_error();
		while($rowdata=mysql_fetch_array($result))
		{
		  $to = $rowdata['email'];
	mail($to,$subject,$message,$headers);
					
}

///////////////////////////////////////
	<form  method="post" action="newsletter.php">					<fieldset>
<p class="first">
      <label for="name">Subject</label>
		<span>
		<input type="sub" name="sub" id="news" value="" size="40" /><br/>
		</span>
		</p>		
		<label for="content">Message:<span>*</span></label>			
		<textarea name="msg" id="msg" rows="4" cols="35"></textarea>		
	  </fieldset>		
		<p>
	    <input type="submit" name="submit" class="button" value="Send Mail" />
	    </p>
	  </form>

Recommended Answers

All 3 Replies

as im understading, u r getting the mail like this
<html>
<body>
<p>name:</p>
<p>email:</p>
</body>
</html>
is it so???

The reason for the php mail() function not working is that the computer with php installed does not have a mail server installed or the mail server is not configured with php correctly. If you are using xampp or wamp then forget about setting up a mail server as it is a devel of a task that 99% of the time is just too hard to do and maintain. The easiest solution if using xampp or wamp is to use a third party mail server such as gmail and evest has posted a link to that. If however this is part of a website on the internet then I would strongly suggest contacting your web host if you are on a shared hosting plan so they can fix the mail server for all people on the server. Perhaps their mail server has crashed due to mass emails or lack of maintenance but what ever the case, if your web host is involved then contact your web host by launching a ticket.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.