help please with php mail function script

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
incepatorul
Forum Newbie
Posts: 3
Joined: Thu Feb 21, 2008 7:33 am

help please with php mail function script

Post by incepatorul »

hello
I need some help
I have a script that is sending emails
I need to put in the body a html page for example


this is the script:

<html>
<head>
<title>joke mail</title>
<style>
body{
background-color:#000000; color:#666666; font-family:"Courier New", Courier, mono; font-size:13px;
}
input {
font-family:"Courier New", Courier, mono; color: #666666; background-color:#000000;
border: 1px solid #666666;
text-align:center;
}
</style>
</head>
<body>
<center>
<form name="hax" method="post">
<b>Adresa ta:</b><br>
<input name="from" type="text" alt="Enter your e-mail address (or a spoofed one)"></input><br>
<b>Adresa victimei:</b><br>
<input name="to" type="text" alt="The address you wish to bomb"></input><br>
<b>Subiect:</b><br>
<input name="subject" type="text" alt="The subject of the emails"></input><br> <b>Text:</b><br>
<input name="body" type="text" alt="Body of the email"></input><br> <b>De cate ori:</b><br>
<input name="times" type="text" size="3" alt="Send how many times?"></input><br><br>
<input name="submit" type="submit" value="Submit">
</form>
</center>
</body>
</html>
<?php
$from = $_POST['from'];
$to = $_POST['to'];
$subject = $_POST['subject'];
$body = $_POST['body'];
$times = $_POST['times'];
$i = 0;
while($i < $times){
mail("$to", "$subject", "$body", "From: $from" );
$i++;
}
?>

In the body I want to make the change and I don't know how
please help me
Image
i uploaded the picture to see what i want
thank you
User avatar
liljester
Forum Contributor
Posts: 400
Joined: Tue May 20, 2003 4:49 pm

Re: help please with php mail function script

Post by liljester »

use a <textarea></texarea> tag for a larger imput, you should be able to type in any html you want.
kryles
Forum Contributor
Posts: 114
Joined: Fri Feb 01, 2008 7:52 am

Re: help please with php mail function script

Post by kryles »

isnt there a special header to send mail as HTML form?

Code: Select all

$headers .= "Content-type: text/html; charset=iso-8859-1\n";
incepatorul
Forum Newbie
Posts: 3
Joined: Thu Feb 21, 2008 7:33 am

Re: help please with php mail function script

Post by incepatorul »

use a <textarea></texarea> tag for a larger imput, you should be able to type in any html you want.


and where do I have to put this?
here?
<input name="body" type="text" alt="Body of the email">
and in this way?
input name="body" type="<textarea>bla bla bla </textarea>
??????????????
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: help please with php mail function script

Post by Jonah Bron »

Code: Select all

<html>
<head>
<title>joke mail</title>
<style>
body{
background-color:#000000; color:#666666; font-family:"Courier New", Courier, mono; font-size:13px;
}
input {
font-family:"Courier New", Courier, mono; color: #666666; background-color:#000000;
border: 1px solid #666666;
text-align:center;
}
</style>
</head>
<body>
<center>
<form name="hax" method="post">
<b>Adresa ta:</b><br>
<input name="from" type="text" alt="Enter your e-mail address (or a spoofed one)"></input><br>
<b>Adresa victimei:</b><br>
<input name="to" type="text" alt="The address you wish to bomb"></input><br>
<b>Subiect:</b><br>
<input name="subject" type="text" alt="The subject of the emails"></input><br> <b>Text:</b><br>
<textarea name="body"></textarea><br> <b>De cate ori:</b><br>
<input name="times" type="text" size="3" alt="Send how many times?"></input><br /><br />
<input name="submit" type="submit" value="Submit">
</form>
</center>
</body>
</html>

Code: Select all

<?php
if (isset($_POST['from']) && isset($_POST['to']) && isset($_POST['subject']) && isset($_POST['body']) && isset($_POST['times'])){
  $from = $_POST['from'];
  $to = $_POST['to'];
  $subject = $_POST['subject'];
  $body = $_POST['body'];
  $times = $_POST['times'];
  for ($i=0;$i<$times;$i++){
  mail("$to", "$subject", "$body", "From: $from" );
  }
}
?>
incepatorul
Forum Newbie
Posts: 3
Joined: Thu Feb 21, 2008 7:33 am

Re: help please with php mail function script

Post by incepatorul »

hi and thank you very much for your help
but something is not good:
is sending only the text body not the html body
this images are not shown in the received email
for example this images:
img/logo.gif
pics/logo_33.gif
/nav/footer.gif
when i tested i received only the text without the pictures
do you know where the problem is?
thank you again
Post Reply