Hi,
ich habe folgendes PHP-Skript:
Und dazu folgende HTML-Form:
Nun zu meinem Problem. Wenn ich lediglich die Textfelder ausfülle, wird meine Mail einwandfrei versendet. Sobald ich ein File anghänge kommt 500 - interner Serverfehler. Habe txt und png probiert, jeweils nur wenige kb groß (<50kb). In meiner PHP.ini sind folgende Parameter gesetzt:
P.s.: Ich habe mit Absicht im PHP-Skript den Fileinput nicht verarbeitet, um diese Fehlerquelle auszuschließen.
Hat jemand Ideen?
Cheers
ich habe folgendes PHP-Skript:
Code:
<?php require 'libs/PHPMailer/PHPMailerAutoload.php'; $mail = new PHPMailer; $mail->SMTPDebug = 0; $mail->setFrom('###', 'Sender'); $mail->addAddress('###', 'User'); $mail->Subject = 'Request'; $body = file_get_contents('mail_template.html'); $body = str_replace('%ContactName%', $_POST['ContactName'], $body); $body = str_replace('%ContactEmail%', $_POST['ContactEmail'], $body); $mail->MsgHTML($body); $mail->IsHTML(true); $mail->CharSet="utf-8"; $mail->isSMTP(); $mail->SMTPOptions = array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ) ); $mail->Host = 'smtp.gmail.com'; // optional // used only when SMTP requires authentication $mail->Port = 587; $mail->SMTPAuth = true; $mail->Username = '###'; $mail->Password = '###'; if(!$mail->send()) { echo 'Message was not sent.'; echo 'Mailer error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent.'; } ?>
Code:
<!DOCTYPE html> <html> <body> <form action="mail_handler.php" method="post" enctype="multipart/form-data"> Name: <input type="text" name="ContactName"><br> Mail: <input type="text" name="ContactEmail"><br> Select image of the product: <input type="file" name="Image"> <input type="submit" value="submit"> </form> </body> </html>
max_execution_time | 30 | 30 |
max_file_uploads | 20 | 20 |
upload_max_filesize | 2M | 2M |
upload_tmp_dir | no value | no value |
Hat jemand Ideen?
Cheers
Kommentar