paffley
11-24-2010, 08:14 PM
Hi,
I'm currently struggling and ive ran out of ideas and cannot find any help on the net, after 3 days of stressing ive decided to ask for help, any help would be hugly appreciated.
This is what I have...
1) I have a newsletter script on my homepage that users type in there email address and hit subscribe (working)
2) that emaill address then gets sent to a flat file/txt file and saves in there (working)
3) I created a webpage with a form area and 2 editboxes 'subject & email from' and 1 textarea 'message' and a submit button (working)
4) When I input the data for the subject, from & message and hit send, that reads the flatfile/txt file and emails those people inside the flatfile/txt file (working)
5) Everything works fine if the email is sent in plain text format but it will not send HTML 'images,links' etc etc (not working)
*Ive tryed everything I can think of and ive looked up and down the script and cannot see any fault. All the content-type is set to text/html and so on. I'm just thinking its something to do with php inside the script its sending from, I know a little about php but im not that clued up on it like a master.
*when i tryed to show an image in the email using <IMG SRC="http://www.mysite.co.uk/test/images/my_logo.png" ALT="logo"> I recieve an email that looks like this:
<IMG SRC=\"http://www.mysite.co.uk/test/images/my_logo.png\" ALT=\"logo\">
Like I say, any help is hugly appreciated :)
heres the code I have...
<?php
$send = $_POST['send'];
if($send){
$email = $_POST['email'];
$emailfile = file_get_contents("mailing.txt");
$emaillist = explode("\n", $emailfile);
foreach ($emaillist as $value)
{
mail($value, $_POST['subject'], $_POST['message'], "From: $email");
}
}
?>
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$mailto = $email;
$subject = $subject;
$message .= $message;
$header = "From: '.$mailfrom."."\r\n";
$header .= "Reply-To: '.$mailfrom."."\r\n";
$header .= "MIME-Version: 1.0"."\r\n";
$header .= "Content-Type: text/html; charset=iso-8859-1"."\r\n";
$header .= "Content-Transfer-Encoding: 8bit"."\r\n";
$header .= "X-Mailer: PHP v".phpversion();
mail($mailto, $subject, $message, $header);
header("Location: newslettersuccess.php");
exit;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Untitled Page</title>
<meta name="generator" content="mine">
<style type="text/css">
div#container
{
width: 710px;
position: relative;
margin-top: 0px;
margin-left: auto;
margin-right: auto;
text-align: left;
}
</style>
<style type="text/css">
body
{
text-align: center;
margin: 0;
background-color: #FFFFFF;
color: #000000;
}
</style>
<script type="text/javascript">
<!--
function ValidateNewsletter_form(theForm)
{
if (theForm.Editbox2.value == "")
{
alert("subject required");
theForm.Editbox2.focus();
return false;
}
if (theForm.Editbox2.value.length < 3)
{
alert("subject required");
theForm.Editbox2.focus();
return false;
}
var strValue = theForm.Editbox1.value;
var strFilter = /^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i;
if (!strFilter.test(strValue))
{
alert("email required");
theForm.Editbox1.focus();
return false;
}
if (theForm.Editbox1.value == "")
{
alert("email required");
theForm.Editbox1.focus();
return false;
}
if (theForm.Editbox1.value.length < 3)
{
alert("email required");
theForm.Editbox1.focus();
return false;
}
return true;
}
//-->
</script>
</head>
<body>
<div id="container">
<div id="wb_Text2" style="margin:0;padding:0;position:absolute;left:12px;top:4px;width:287px;height:34px;text-align:left;z-index:6;">
<font style="font-size:29px" color="#00D5FF" face="Arial"><b>Newsletter</b></font></div>
<div id="wb_Text1" style="margin:0;padding:0;position:absolute;left:12px;top:30px;width:712px;height:18px;text-align:left;z-index:7;">
<font style="font-size:16px" color="#C0C0C0" face="Arial">- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -</font></div>
<div id="wb_Form2" style="position:absolute;background-color:#C0C0C0;left:64px;top:54px;width:603px;height:566px;z-index:8">
<form name="Newsletter_form" method="post" action="<?php echo basename(__FILE__); ?>" enctype="text/html" id="Form2" onsubmit="return ValidateNewsletter_form(this)">
<div id="wb_Text4" style="margin:0;padding:0;position:absolute;left:8px;top:458px;width:60px;height:14px;text-align:left;z-index:0;">
<font style="font-size:11px" color="#000000" face="Arial">subject:</font></div>
<input type="text" id="Editbox2" style="position:absolute;left:55px;top:454px;width:537px;height:18px;border:1px #C0C0C0 solid;font-family:Arial;font-size:13px;z-index:1" name="subject" value="Ibloo Newsletter">
<div id="wb_Text3" style="margin:0;padding:0;position:absolute;left:8px;top:487px;width:60px;height:14px;text-align:left;z-index:2;">
<font style="font-size:11px" color="#000000" face="Arial">from:</font></div>
<input type="text" id="Editbox1" style="position:absolute;left:55px;top:482px;width:537px;height:18px;border:1px #C0C0C0 solid;font-family:Arial;font-size:13px;z-index:3" name="email" value="newsletter@ibloo.co.uk">
<textarea name="message" id="TextArea2" style="position:absolute;left:8px;top:7px;width:585px;height:363px;border:1px #C0C0C0 solid;font-family:Arial;font-size:13px;z-index:4" rows="21" cols="91"></textarea>
<input type="submit" id="Button2" name="send" value="Submit" style="position:absolute;left:499px;top:535px;width:96px;height:25px;font-family:Arial;font-size:13px;z-index:5">
</form>
</div>
</div>
</body>
</html>
Kind regards,
paffley
I'm currently struggling and ive ran out of ideas and cannot find any help on the net, after 3 days of stressing ive decided to ask for help, any help would be hugly appreciated.
This is what I have...
1) I have a newsletter script on my homepage that users type in there email address and hit subscribe (working)
2) that emaill address then gets sent to a flat file/txt file and saves in there (working)
3) I created a webpage with a form area and 2 editboxes 'subject & email from' and 1 textarea 'message' and a submit button (working)
4) When I input the data for the subject, from & message and hit send, that reads the flatfile/txt file and emails those people inside the flatfile/txt file (working)
5) Everything works fine if the email is sent in plain text format but it will not send HTML 'images,links' etc etc (not working)
*Ive tryed everything I can think of and ive looked up and down the script and cannot see any fault. All the content-type is set to text/html and so on. I'm just thinking its something to do with php inside the script its sending from, I know a little about php but im not that clued up on it like a master.
*when i tryed to show an image in the email using <IMG SRC="http://www.mysite.co.uk/test/images/my_logo.png" ALT="logo"> I recieve an email that looks like this:
<IMG SRC=\"http://www.mysite.co.uk/test/images/my_logo.png\" ALT=\"logo\">
Like I say, any help is hugly appreciated :)
heres the code I have...
<?php
$send = $_POST['send'];
if($send){
$email = $_POST['email'];
$emailfile = file_get_contents("mailing.txt");
$emaillist = explode("\n", $emailfile);
foreach ($emaillist as $value)
{
mail($value, $_POST['subject'], $_POST['message'], "From: $email");
}
}
?>
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$mailto = $email;
$subject = $subject;
$message .= $message;
$header = "From: '.$mailfrom."."\r\n";
$header .= "Reply-To: '.$mailfrom."."\r\n";
$header .= "MIME-Version: 1.0"."\r\n";
$header .= "Content-Type: text/html; charset=iso-8859-1"."\r\n";
$header .= "Content-Transfer-Encoding: 8bit"."\r\n";
$header .= "X-Mailer: PHP v".phpversion();
mail($mailto, $subject, $message, $header);
header("Location: newslettersuccess.php");
exit;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Untitled Page</title>
<meta name="generator" content="mine">
<style type="text/css">
div#container
{
width: 710px;
position: relative;
margin-top: 0px;
margin-left: auto;
margin-right: auto;
text-align: left;
}
</style>
<style type="text/css">
body
{
text-align: center;
margin: 0;
background-color: #FFFFFF;
color: #000000;
}
</style>
<script type="text/javascript">
<!--
function ValidateNewsletter_form(theForm)
{
if (theForm.Editbox2.value == "")
{
alert("subject required");
theForm.Editbox2.focus();
return false;
}
if (theForm.Editbox2.value.length < 3)
{
alert("subject required");
theForm.Editbox2.focus();
return false;
}
var strValue = theForm.Editbox1.value;
var strFilter = /^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i;
if (!strFilter.test(strValue))
{
alert("email required");
theForm.Editbox1.focus();
return false;
}
if (theForm.Editbox1.value == "")
{
alert("email required");
theForm.Editbox1.focus();
return false;
}
if (theForm.Editbox1.value.length < 3)
{
alert("email required");
theForm.Editbox1.focus();
return false;
}
return true;
}
//-->
</script>
</head>
<body>
<div id="container">
<div id="wb_Text2" style="margin:0;padding:0;position:absolute;left:12px;top:4px;width:287px;height:34px;text-align:left;z-index:6;">
<font style="font-size:29px" color="#00D5FF" face="Arial"><b>Newsletter</b></font></div>
<div id="wb_Text1" style="margin:0;padding:0;position:absolute;left:12px;top:30px;width:712px;height:18px;text-align:left;z-index:7;">
<font style="font-size:16px" color="#C0C0C0" face="Arial">- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -</font></div>
<div id="wb_Form2" style="position:absolute;background-color:#C0C0C0;left:64px;top:54px;width:603px;height:566px;z-index:8">
<form name="Newsletter_form" method="post" action="<?php echo basename(__FILE__); ?>" enctype="text/html" id="Form2" onsubmit="return ValidateNewsletter_form(this)">
<div id="wb_Text4" style="margin:0;padding:0;position:absolute;left:8px;top:458px;width:60px;height:14px;text-align:left;z-index:0;">
<font style="font-size:11px" color="#000000" face="Arial">subject:</font></div>
<input type="text" id="Editbox2" style="position:absolute;left:55px;top:454px;width:537px;height:18px;border:1px #C0C0C0 solid;font-family:Arial;font-size:13px;z-index:1" name="subject" value="Ibloo Newsletter">
<div id="wb_Text3" style="margin:0;padding:0;position:absolute;left:8px;top:487px;width:60px;height:14px;text-align:left;z-index:2;">
<font style="font-size:11px" color="#000000" face="Arial">from:</font></div>
<input type="text" id="Editbox1" style="position:absolute;left:55px;top:482px;width:537px;height:18px;border:1px #C0C0C0 solid;font-family:Arial;font-size:13px;z-index:3" name="email" value="newsletter@ibloo.co.uk">
<textarea name="message" id="TextArea2" style="position:absolute;left:8px;top:7px;width:585px;height:363px;border:1px #C0C0C0 solid;font-family:Arial;font-size:13px;z-index:4" rows="21" cols="91"></textarea>
<input type="submit" id="Button2" name="send" value="Submit" style="position:absolute;left:499px;top:535px;width:96px;height:25px;font-family:Arial;font-size:13px;z-index:5">
</form>
</div>
</div>
</body>
</html>
Kind regards,
paffley