problem with mail function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nimatramon
Forum Newbie
Posts: 1
Joined: Tue Jul 22, 2008 4:31 am

problem with mail function

Post by nimatramon »

Hi

This is my mailer script:
I have used it one time before and there was nothing wrong.
but now when when i send emails , the images are not shown in target email, i have sent different standard HTML pages but in non of them images are shown.
Please tell me what is wrong:

----------------------------------------------------------------------------------------


<?
include_once("top.php");
?>

<?
if ($_SESSION[lgd]==true)
{
?>

<table align="center" width="515" height="700" border="1">
<tr>
<td valign="top" width="505">Enter account range that you want to send mail to:
<form name="mailform" method="post">
Sender Email <input type="text" name="email" value=<?=$_SESSION[email] ?> />
<br />
Subject:
<input maxlength="100" type="text" name="subj" value=<?=$_SESSION[subj]?> >
<br>

Content:
<textarea name="content" rows="20" cols="40" tabindex="text"><?=addslashes($_SESSION[content])?>
</textarea>
<br />


<br>
P ID
<input maxlength="10" id="a1" type="text" name="acc1" >
<br>
S ID

<input maxlength="10" id="a2" type="text" name="acc2">
<br>
<br />
<input name="submit" type="submit">

</form>


</td>
</tr>
</table>







<?
}
else
{



?>
<p align="center">
<form name="loginform" method="post">
User Name:
<input name="username" type="text">
<br>
Password:
<input type="password" name="password" >
<br>
<input name="submit" type="submit" value="Enter">

</form>

</p>

<?



}
?>
<?
if ($_POST[password])
{
if ($_POST[username]=="admin" and $_POST[password]=="fara")
{

$_SESSION[lgd]=true;
?>
<META HTTP-EQUIV="refresh" CONTENT="1; URL=index.php">
<?

}



}
?>


<?

if ($_POST[acc1])
{

$acc1=$_POST[acc1];
$acc2=$_POST[acc2];
$subj=$_POST[subj];
$email=$_POST[email];
$_SESSION[email]=$email;
$_SESSION[subj]=$subj;
$content=$_POST[content];
//$content2=$_POST[content2];

$_SESSION[content]=($content);
//$_SESSION[content2]=($content2);

if ($_POST[autosend]==0)
{

$res=mysql_query("select name, Family,email from accounts where accountid between $acc1 and $acc2");
echo mysql_error();
// To send HTML mail, the Content-type header must be set

$headers .= "From: $_POST[email]< $_POST[email] >" . "\r\n";
$headers .= 'To: Customer < Customer >' . "\r\n";
$headers .= 'Reply-To: ';
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers


while ($fetch=mysql_fetch_object($res))
{
//$msg= $content . $fetch->name."" . $fetch->Family . $content2;
$msg= $content;
if (mail($fetch->email,$subj,$msg,$headers))

{
echo"Sent to $fetch->email <br>";
echo $fetch->name;
}

}

mysql_close();
}
elseif($_POST[autosned]==1)
{


}

}



?>
--------------------------------------------
Db connection is inside the top.php
Post Reply