drmy1050 2011-01-20 11:06
浏览 57
已采纳

php发送一封带附件的邮件,然后复制出来

I did my first application of mailer php today, very nice, sending 2 pdf attachments,

but for record keeping, I need a copy of the mail to go to another mail, but with out the attachments,

how to accomplish this please??

here the code (edit, sorry, )

form html:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Contact Form</title>
<meta name="Generator" content="Alleycode HTML Editor">
<meta name="Description" content="Your description here...">
<meta name="Keywords" content="Your keywords here...">
</head>
<body>
<form method="post" action="sendmail2.php">
<p>
<label>Name:</label> <br/> <input type="text" name="name" size="48" height="40"/>
</p>
<p>
<label>Email:</label> <br/> <input type="text" name="email" size="48" height="40"/>
</p>
<p>
<label>Child's Name:</label> <br/> <input type="text" name="childname" size="48"    height="40"/>
</p>
<p>
<label>Site:</label>
<br/>
<textarea name="site" rows="2" cols="45" overflow:hidden>xx.com.au</textarea>
</p>
<p>&nbsp;</p>
<p>
<label>Days:</label>
<br/>
<textarea name="days" rows="2" cols="45" overflow:hidden>Monday, Tuesday, Wednesday,  Thursday, Friday</textarea>
</p>
<p>&nbsp;</p>
<p>
<input type="submit" value="Send"/>
 <a href="xx/form.html">clear</a></p>
 </form>
 </body>
 </html>

sendmail2.php:

<?php
require("../phpmailer/class.phpmailer.php");
include("email.php");
$name = $_POST['name'];
$childname = $_POST['childname'];
$site = $_POST['site'];
$days = $_POST['days'];
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = "xxx.com"; // SMTP servers
$mail->Username = "xxx";   // SMTP username
$mail->Password = "xxx"; // SMTP password
$mail->AddAddress($_POST['email']);
$mail->From     = "xxx@ax.com.au";
$mail->FromName = "xxx_online";
$mail->Subject = "Message from Alouette";
$mail->IsHTML(true);
$mail->Body = $message;
$mail->AddAttachment("../attachs/x.pdf");
$mail->AddAttachment("../attachs/xd.pdf");
if($mail->Send()) {
echo "Message sent! Thanks !          ";
print('<a href="xu/mail/form.html">Reset and Back</a>');
} 
?>

email.php

<?php
$message = '
Hello  '.$name.', <br/>
we have received your interest in child care services for  '.$childname.' from the    '.$site.' website. <br/>
<br/>
 '.$days.' 
<br/> <br/>
Should you have any questions regarding the information on our enrolment form or  services please do not hesitate to contactkkk
<br/> <br/> <br/>

Regards, <br/>


<a href="mailto:x@x.com.au">x@nx.com.au</a>   &nbsp;&nbsp;&nbsp;  <a   href="http://www.nx.com.au" target="_new">www.neo-it.com.au</a> 
<br/> 
<strong>Childcare Management Services</strong>
<br/> <br/>


    '
    ?>

thanks a lot!

  • 写回答

2条回答 默认 最新

  • dougupang0901 2011-01-25 04:10
    关注

    I did it this way with the help of phpFreaks

    very simple! thanks freaks!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥60 pb数据库修改或者求完整pb库存系统,需为pb自带数据库
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路