我创建了一个邮件表单,但是如果我附加了10个以上的pdf,我就会收到这个错误:
Errore durante l'invio : Could not instantiate mail function.
我用谷歌搜索但没有关于最大邮件大小的最大附件大小,我该怎么办?有人可以帮帮我吗?
我使用this one
这是代码的一部分
$mail = new PHPMailer();
$body = $_POST['message'];
//$mail->AddReplyTo('replyto@email.com', 'Reply to name');
//$mail->SetFrom('mailbox@email.com', 'Mailbox name');
$address = $_POST['email'];
$mail->AddAddress($_POST['email'], $_POST['to']);
$mail->Subject = $_POST['subject'];
$mail->MsgHTML($body);
foreach($_POST['pdfs'] as $selected){
$mail->AddAttachment($selected);
}
if(!$mail->Send()) {
echo '<p class="text-left text-danger">Errore durante l\'invio : ' . $mail->ErrorInfo .'</p>';
} else {
echo '<p class="text-left text-success"> Messaggio inviato</p>';
}
} else echo '<p class="text-left text-danger">Nessun pdf selezionato</p>';
答案 0 :(得分:-2)
<?php
include "class.phpmailer.php";
include "class.smtp.php";
$mail = new PHPMailer();
$body = $_POST['message'];
//$mail->AddReplyTo('replyto@email.com', 'Reply to name');
//$mail->SetFrom('mailbox@email.com', 'Mailbox name');
$address = $_POST['email'];
$mail->AddAddress($_POST['email'], $_POST['to']);
$mail->Subject = $_POST['subject'];
$mail->MsgHTML($body);
foreach($_POST['pdfs'] as $selected){
$mail->AddAttachment($selected);
}
if(!$mail->Send()) {
echo '<p class="text-left text-danger">Errore durante l\'invio : ' . $mail->ErrorInfo .'</p>';
} else {
echo '<p class="text-left text-success"> Messaggio inviato</p>';
}
?>