Upload PHPMailer从上载添加附件

Upload PHPMailer从上载添加附件,upload,phpmailer,email-attachments,Upload,Phpmailer,Email Attachments,我想我已经试过了。仍然不将文件附加到邮件。有什么想法吗? 正在尝试附加大小小于3mb的照片。已尝试附加文本、图像、音频。 我正在使用上传表单 E: 照片 发送没有附件的电子邮件 已解决 Change name=“MAX\u FILE\u SIZE”value=“30000”->name=“MAX\u FILE\u SIZE”value=“”请阅读您的邮件根本没有发送吗?或者只是不发送附件?我们可以看到您用于发布的表单的HTML吗?和。 require_once('class.phpmaile

我想我已经试过了。仍然不将文件附加到邮件。有什么想法吗? 正在尝试附加大小小于3mb的照片。已尝试附加文本、图像、音频。 我正在使用上传表单

E:


照片

发送没有附件的电子邮件

已解决
Change name=“MAX\u FILE\u SIZE”value=“30000”->name=“MAX\u FILE\u SIZE”value=“”

请阅读您的邮件根本没有发送吗?或者只是不发送附件?我们可以看到您用于发布的表单的HTML吗?和。
require_once('class.phpmailer.php');
        include('class.smtp.php');

        $mail             = new PHPMailer();
        $body = file_get_contents('index.php');
        $body = eregi_replace("[\]",'',$body);
        $mail->IsSMTP(); // telling the class to use SMTP
        $mail->Host       = "smtp.gmail.com"; // SMTP server
        //$mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
                                                   // 1 = errors and messages
                                                   // 2 = messages only
        $mail->SMTPAuth   = true;                  // enable SMTP authentication
        $mail->SMTPSecure = "tls";
        $mail->Host       = "smtp.gmail.com"; // sets the SMTP server
        $mail->Port       = 587;                    // set the SMTP port for the GMAIL server
        $mail->Username   = "mail@gmail.com"; // SMTP account username
        $mail->Password   = "password";        // SMTP account password

        $mail->SetFrom('mail@gmail.com', 'First Last');

        $mail->AddReplyTo("mail@gmail.pl","First Last");

        $mail->Subject    = "New Event";

        $mail->AltBody    = "To view the message, please use an HTML compatible email viewer!";



        if ($_FILES['Photo']['error'] == UPLOAD_ERR_OK)
        {
            $address = "mail@gmail.com";
            $mail->AddAttachment($_FILES['Photo']['tmp_name'], $_FILES['Photo']['name']);  
            $mail->AddEmbeddedImage($_FILES['Photo']['tmp_name'], $_FILES['Photo']['name']);  
            $mail->AddAddress($address, "John Doe");  

            if(!$mail->Send()) 
            {
            echo "Mailer Error: " . $mail->ErrorInfo;
            }   
            else 
            {
            echo "Message sent!";
            }
        }
    <form enctype="multipart/form-data" id="new_event" action="event.php" method="post" name="new_event">
<p><label for="Photo">Photo </label><input type="hidden" name="MAX_FILE_SIZE" value="30000" /><input type="file" name="Photo" value="Sarch" /></p>
<input type="submit" name="next1" value="Add Event" />
</form>