How could I add a attachment feature to this code so it would send a file with the email for my blog, the attachment would be a zip file stored locally… i don’t need a upload form just the code
<?php
if (isset($_POST["submit"])) {
$list=$_POST["list"];
$email=$_POST["email"];
$subject=$_POST["subject"];
$body=$_POST["body"];
$replyto=$_POST["replyto"];
$header = "From: $email\r\nReply-to: $replyto\r\nMIME-Version: 1.0\r\nContent-Type: text/html; charset=UTF-8\r\n";
$msg="";
$t_email=explode(", ",$list);
for($i=0;$i<(count($t_email));$i=$i+1) {
if (mail($t_email[$i],$subject,$body,$header)) {
$msg.="Successfully sent to ".$t_email[$i]."<br />";
} else {
$msg.="Failed to be sent to ".$t_email[$i]."<br />";
}
}
echo $msg;
}
?>
<?php
$username = "username";
$password = "password";
if ($_POST['txtUsername'] != $username || $_POST['txtPassword'] != $password) {
?>
<center>
<h1>PHPMailer</h1>
<form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<label for="txtUsername">Username:</label>
<input type="text" title="Enter your Username" name="txtUsername" /></p>
<label for="txtpassword">Password:</label>
<input type="password" title="Enter your password" name="txtPassword" /></p>
<input type="submit" name="Submit" value="Login" /></p>
</center>
</form>
<?php
}
else {
?>
<html>
<body>
<form method="post">
Enter List: <br>
<textarea name="list" rows="10" cols="40"></textarea><br />
Enter Subject: <br>
<input name="subject" value="" size="40"/><br />
Reply: <br>
<input name="replyto" value="" size="40"/><br />
Enter Email Content: <br>
<textarea name="body" rows="10" cols="40"></textarea><br />
Enter Email To Be Spoofed: <br>
<input name="email" value="" size="40"/><br />
<button name="submit" type="submit" style="width: 345px;"><span>Send</span></button>
</form>
</body>
</html>
<?php
}
?>