Jump to content

sendmail form sending HTML page


pixeltrace

Recommended Posts

guys,

 

i need help, i have a sendmail form that should send HTML pages to the email address that i specify

 

i tested it first sending to individual emails and it worked.

unfortunately, when you try to view the HTML page that you send

first, the color is different, the text is also different and the links are not clickable.

 

hope you could help me fix the problem.

below is the code for my form page

<?php
include("db_connect.php");
?> 
	<table width="100" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="6" align="left"><img src="../images/spacer.gif" width="6" height="10" /></td>
            <td width="100%"><form method="post" action="emailalert.php?id=3">
              <table width="216" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1" /></td>
                </tr>
                <tr>
                  <td align="left" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1" /></td>
                  <td width="214" valign="top"><table width="558" border="0" cellspacing="2" cellpadding="3">
                      <tr>
                        <td colspan="3" valign="top"><img src="images/spacer.gif" width="10" height="1" /></td>
                      </tr>
                      <tr>
                        <td colspan="3" bgcolor="#999999" class="text2">SEND EMAIL ALERTS </td>
                      </tr>
                      <tr>
                        <td colspan="3" valign="top" class="text7"> </td>
                      </tr>
                      <tr>
                        <td width="119" align="right" valign="top" class="text6">send by   :</td>
                        <td> </td>
                        <td width="412" class="text7">
					<select name="to" class="textfield1">
					<option selected value="all">Entire list</option>
					<option value="notall">Specialization</option>
					<option value="peremail">Individual Email</option>
					</select> 

                          </select></td>
                      </tr>
                      <tr>
                        <td align="right"><span class="text6">by specialization   : </span></td>
                        <td> </td>
                        <td><select name="specialization">
                          <option value="" selected="selected">-- select specialization here --</option>
                          <?
		$uSql = "SELECT specialization FROM specialization";
		$uResult = mysql_query($uSql, $connection);
		if(!$uResult){
		echo 'no data found';
		}else{
		while($uRow = mysql_fetch_array($uResult)){
			?>
                          <option value="<?= $uRow[specialization]?>">
                            <?= $uRow[specialization]?>
                          </option>
                          <?
			}    
			}
			?>
                        </select></td>
                      </tr>
                      <tr>
                        <td align="right"> </td>
                        <td> </td>
                        <td class="text7">*if by specialization, please select one here </td>
                      </tr>
                      <tr>
                        <td align="right"><span class="text6">per email :</span> </td>
                        <td> </td>
                        <td><span class="text7">
                          <input name="peremail" type="text" class="textfield" maxlength="100" size="40" />
                        </span></td>
                      </tr>
                      <tr>
                        <td align="right"> </td>
                        <td> </td>
                        <td class="text7">*if per email, please input the email address here </td>
                      </tr>
                      <tr>
                        <td align="right"><span class="text6">subject  :</span></td>
                        <td> </td>
                        <td><span class="text7">
                          <input name="subject" type="text" class="textfield" maxlength=100 size=40>
                        </span></td>
                      </tr>
                      <tr>
                        <td align="right" valign="top" class="text6"> </td>
                        <td align="right" valign="top" class="text6"> </td>
                        <td valign="top" class="text7"> </td>
                      </tr>
                      <tr>
                        <td colspan="3" valign="top" class="text6"><hr></td>
                      </tr>
                      <tr>
                        <td colspan="3" valign="top" class="text6">HTML BODY: copy & paste the HTML page here <span class="text7"></span> </td>
                      </tr>
                      <tr>
                        <td colspan="3" align="center" valign="top" class="text6"><textarea id="elm1" name="message" rows="35" cols="80" style="width: 100%"></textarea></td>
                      </tr>
                      <tr>
                        <td colspan="3" align="center" valign="top" class="text6"><input type="submit" name="submit" value="send" class="textfield1" />
<input type=hidden value=http://www. name=redirect></td>
                      </tr>
                      <tr>
                        <td colspan="3" align="center" valign="top" class="text6"> </td>
                      </tr>
                  </table></td>
                  <td align="right" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1" /></td>
                </tr>
                <tr>
                  <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1" /></td>
                </tr>
              </table>
            </form></td>
            <td width="6" align="right"><img src="../images/spacer.gif" width="6" height="10" /></td>
          </tr>
        </table>



 

 

and this is the code for my emailalert.php?id=3

<?php
$to = $_POST['to'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$peremail = $_POST['peremail'];
$specialization = $_POST['specialization'];

switch($to)
{
case "all":
	$x = 1;
	$hold = 50; // quantity of emails sent before 3 sec delay
	$emails = mysql_query("SELECT email FROM applicant WHERE subscribe = 'yes'");
	while ($sendemail = mysql_fetch_array($emails))
	{
		$email = $sendemail["email"];
		mail($email, $subject,
		$message, "From:JobHiRings <posmaster@jobhirings.com>");

		$x++;
		if($x == $hold)
		{ // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout
			sleep(3);
			$x = 0;
		}
		echo '<script language=javascript> alert("Email alert has been submitted!");top.location = "emailalert.php?id=1";</script>';
	} // end of while loop
break;
case "notall":
	$byspecialization = mysql_query("SELECT email FROM applicant WHERE specialization = '$specialization' AND subscribe = 'yes'");
	while ($countmail = mysql_fetch_array($byspecialization))
	{
		$email = $countmail["email"];
		$okemail = mail($email, $subject,
			$message, "From:JobHiRings <postmaster@jobhirings.com>"
		);
		$x++;
		if($x == $hold)
		{ // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout
			sleep(3);
			$x = 0;
		}
		echo '<script language=javascript> alert("Email alert has been submitted!");top.location = "emailalert.php?id=1";</script>';
	} // end of while loop
break;
case "peremail":
    $replyto = "postmaster@jobhirings.com";
    $returnpath = "postmaster@jobhirings.com";
	$headers = "From:JobHiRings <postmaster@jobhirings.com>\r\n";
	$headers .= "Reply-To: $replyto\r\n";
	$headers .= "Return-Path: $returnpath\r\n";
	$headers .= "MIME-Version: 1.0\r\n";
	$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
	$email = "$peremail";
	$okemail = mail($email, $subject,
	$message,$headers);
	$x++;
	if(okemail)
	{ // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout
		sleep(3);
		$x = 0;
		echo '<script language=javascript> alert("Email alert has been submitted!");top.location = "emailalert.php?id=1";</script>';
	} // end of while loop
break;

}

?>

 

 

hope you could help me with this.

 

thanks!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.