向博客邮件添加附件

我如何在此代码中添加附件功能,以便它随电子邮件发送文件发送给我的博客,附件将是本地存储的zip文件。我只需要代码就不需要上传表单。

我只是想在服务器上创建附件,附件是一个zip文件,其中包含一些为我工作的人的时间表。

 <?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

}

?>
gillettcool 回答:向博客邮件添加附件

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2643164.html

大家都在问